Detalii evaluare #53625149

Rezumat problemă

Se dă un număr natural n cu cel puțin două cifre, care conține atât cifre pare cât și cifre impare. Calculați suma dintre cea mai mică cifră pară și cea mai mare cifră impară a lui n.

Detalii

Problema par_impar3 Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #53625149 Utilizator Alexandra Iacobescu (al_eexandra)
Fișier par_impar3.cpp Dimensiune 235 B
Data încărcării 06 Noiembrie 2024, 18:58 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

par_impar3.cpp: In function 'int main()':
par_impar3.cpp:6:2: error: reference to 'min' is ambiguous
  min=9;

  ^
par_impar3.cpp:3:8: note: candidates are: int min
 int x, min, max;

        ^
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 par_impar3.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)
     ^
par_impar3.cpp:7:2: error: reference to 'max' is ambiguous
  max=0;

  ^
par_impar3.cpp:3:13: note: candidates are: int max
 int x, min, max;

             ^
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 par_impar3.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)
     ^
par_impar3.cpp:10:11: error: reference to 'min' is ambiguous
  if (x%10<min) min=x%10;

           ^
par_impar3.cpp:3:8: note: candidates are: int min
 int x, min, max;

        ^
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 par_impar3.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)
     ^
par_impar3.cpp:10:16: error: reference to 'min' is ambiguous
  if (x%10<min) min=x%10;

                ^
par_impar3.cpp:3:8: note: candidates are: int min
 int x, min, max;

        ^
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 par_impar3.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)
     ^
par_impar3.cpp:11:11: error: reference to 'max' is ambiguous
  if (x%10>max) max=x%10;

           ^
par_impar3.cpp:3:13: note: candidates are: int max
 int x, min, max;

             ^
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 par_impar3.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)
     ^
par_impar3.cpp:11:16: error: reference to 'max' is ambiguous
  if (x%10>max) max=x%10;

                ^
par_impar3.cpp:3:13: note: candidates are: int max
 int x, min, max;

             ^
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 par_impar3.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)
     ^
par_impar3.cpp:14:10: error: reference to 'min' is ambiguous
  cout << min+max;

          ^
par_impar3.cpp:3:8: note: candidates are: int min
 int x, min, max;

        ^
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 par_impar3.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)
     ^
par_impar3.cpp:14:14: error: reference to 'max' is ambiguous
  cout << min+max;

              ^
par_impar3.cpp:3:13: note: candidates are: int max
 int x, min, max;

             ^
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 par_impar3.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)
     ^
par_impar3.cpp:15:14: error: expected '}' at end of input
      return 0;
              ^

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