Detalii evaluare #53872697

Rezumat problemă

Se dau n numere naturale. Considerăm poziţiile lor numerotate de la 1 la n.
Să se determine cea mai mare valoare memorată pe o poziţie pară şi cea mai mică valoare de două cifre aflată pe o poziţie impară.

Concurs de pregatire CNFB clasa a V-a

Detalii

Problema calcParImpar Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #53872697 Utilizator Ungureanu Dennis (Dennis_Ungureanu)
Fișier calcparimpar.cpp Dimensiune 474 B
Data încărcării 13 Noiembrie 2024, 18:03 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

calcparimpar.cpp: In function 'int main()':
calcparimpar.cpp:6:5: error: reference to 'max' is ambiguous
     max = 0;

     ^
calcparimpar.cpp:3:5: note: candidates are: int max
 int max, min, i, n, x;

     ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:                 template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:                 template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:7:5: error: reference to 'min' is ambiguous
     min = 1000000001;

     ^
calcparimpar.cpp:3:10: note: candidates are: int min
 int max, min, i, n, x;

          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:                 template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:                 template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:11:21: error: reference to 'max' is ambiguous
             if (x > max)

                     ^
calcparimpar.cpp:3:5: note: candidates are: int max
 int max, min, i, n, x;

     ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:                 template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:                 template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:12:17: error: reference to 'max' is ambiguous
                 max = x;

                 ^
calcparimpar.cpp:3:5: note: candidates are: int max
 int max, min, i, n, x;

     ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:                 template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:                 template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:14:41: error: reference to 'min' is ambiguous
             if (x>=10 && x <= 99 && x < min)

                                         ^
calcparimpar.cpp:3:10: note: candidates are: int min
 int max, min, i, n, x;

          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:                 template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:                 template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:15:17: error: reference to 'min' is ambiguous
                 min = x;

                 ^
calcparimpar.cpp:3:10: note: candidates are: int min
 int max, min, i, n, x;

          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:                 template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:                 template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:17:11: error: reference to 'max' is ambiguous
     cout<<max<<" ";

           ^
calcparimpar.cpp:3:5: note: candidates are: int max
 int max, min, i, n, x;

     ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:                 template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:                 template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:18:9: error: reference to 'min' is ambiguous
     if (min != 1000000001)

         ^
calcparimpar.cpp:3:10: note: candidates are: int min
 int max, min, i, n, x;

          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:                 template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:                 template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
calcparimpar.cpp:19:15: error: reference to 'min' is ambiguous
         cout<<min;

               ^
calcparimpar.cpp:3:10: note: candidates are: int min
 int max, min, i, n, x;

          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from calcparimpar.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:                 template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:                 template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^

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