Detalii evaluare #36977349

Rezumat problemă

#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.

Detalii

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 Constantin Florina-Beatrice (beatriceconstantin)
Fișier limite.cpp Dimensiune 760 B
Data încărcării 05 Iunie 2022, 23:49 Scor / rezultat Eroare de compilare

Evaluare


Mesaj 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
                  ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Limite face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.