#2274
Limite
C++
Se dau n
numere naturale. Afișați tipul de date C++ minim ca număr de octeți permite memorarea fiecărui număr. Dacă un număr încape și în tipul cu semn și în tipul fără semn, se afișează tipul cu semn.
Problema | Limite | Operații I/O |
limite.in /limite.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #36977349 | Utilizator | |
Fișier | limite.cpp | Dimensiune | 760 B |
Data încărcării | 05 Iunie 2022, 23:49 | Scor / rezultat | Eroare de compilare |
limite.cpp:20:22: warning: integer constant is so large that it is unsigned [enabled by default] else if(x <= 18446744073709551615) cout << "unsigned long long" << endl; ^ limite.cpp: In function 'int main()': limite.cpp:9:5: error: reference to 'cin' is ambiguous cin >> n; ^ limite.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("limite.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ limite.cpp:12:9: error: reference to 'cin' is ambiguous cin >> x; ^ limite.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("limite.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ limite.cpp:13:22: error: reference to 'cout' is ambiguous if(x <= 127) cout << "char" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:14:27: error: reference to 'cout' is ambiguous else if(x <= 255) cout << "unsigned char" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:15:29: error: reference to 'cout' is ambiguous else if(x <= 32767) cout << "short" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:16:29: error: reference to 'cout' is ambiguous else if(x <= 65535) cout << "unsigned short" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:17:34: error: reference to 'cout' is ambiguous else if(x <= 2147483647) cout << "int" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:18:34: error: reference to 'cout' is ambiguous else if(x <= 4294967295) cout << "unsigned int" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:19:43: error: reference to 'cout' is ambiguous else if(x <= 9223372036854775807) cout << "long long" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ limite.cpp:20:44: error: reference to 'cout' is ambiguous else if(x <= 18446744073709551615) cout << "unsigned long long" << endl; ^ limite.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("limite.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from limite.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Limite face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.