#187
CifFrecv
Să se scrie un program care citeşte cel mult 1.000.000
de numere naturale din intervalul închis [0,9]
şi determină cel mai mare număr prim citit şi numărul său de apariţii.
Variante Bacalaureat 2009
Problema | CifFrecv | Operații I/O |
![]() ciffrecv.in /ciffrecv.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
Id soluție | #57605834 | Utilizator | |
Fișier | ciffrecv.cpp | Dimensiune | 691 B |
Data încărcării | 07 Aprilie 2025, 13:35 | Scor / rezultat | Eroare de compilare |
ciffrecv.cpp:5:1: error: 'ifstream' does not name a type ifstream fin("ciffrecv.in") ^ ciffrecv.cpp: In function 'int main()': ciffrecv.cpp:12:11: error: 'fin' was not declared in this scope while(fin>>x) ^ ciffrecv.cpp:23:44: error: 'max' was not declared in this scope int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:44: note: suggested alternative: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from ciffrecv.cpp:4: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: 'std::max' max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ ciffrecv.cpp:23:45: error: 'max' was not declared in this scope int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:45: note: suggested alternative: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from ciffrecv.cpp:4: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: 'std::max' max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ ciffrecv.cpp:23:45: error: redeclaration of '<typeprefixerror>max' int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:44: note: previous declaration '<typeprefixerror>max' int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:46: error: 'max' was not declared in this scope int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:46: note: suggested alternative: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from ciffrecv.cpp:4: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: 'std::max' max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ ciffrecv.cpp:23:46: error: redeclaration of '<typeprefixerror>max' int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:23:44: note: previous declaration '<typeprefixerror>max' int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^ ciffrecv.cpp:25:5: error: 'fout' was not declared in this scope fout<<7<<' '<<cnt7; ^ ciffrecv.cpp:27:5: error: 'fout' was not declared in this scope fout<<5<<' '<<cnt5; ^ ciffrecv.cpp:29:5: error: 'fout' was not declared in this scope fout<<3<<' '<<cnt3; ^ ciffrecv.cpp:31:5: error: 'fout' was not declared in this scope fout<<2<<' '<<cnt2; ^ ciffrecv.cpp:23:9: warning: unused variable 'mx' [-Wunused-variable] int mx=max(cnt2,max(cnt3,max(cnt5, cnt7))); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CifFrecv 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ă.