#303
Eratostene
Se dau n
numere naturale mai mici decât 1.000.000
. Determinaţi câte dintre ele sunt prime.
Problema | Eratostene | Operații I/O |
eratostene.in /eratostene.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53481235 | Utilizator | |
Fișier | eratostene.cpp | Dimensiune | 652 B |
Data încărcării | 02 Noiembrie 2024, 09:40 | Scor / rezultat | Eroare de compilare |
eratostene.cpp:4:1: error: 'ifstream' does not name a type ifstream fin("eratostene.in"); ^ eratostene.cpp:5:1: error: 'ofstream' does not name a type ofstream fout("eratostene.out"); ^ eratostene.cpp: In function 'int32_t main()': eratostene.cpp:2:13: error: 'fin' was not declared in this scope #define cin fin ^ eratostene.cpp:11:5: note: in expansion of macro 'cin' cin.tie(nullptr)->sync_with_stdio(false); ^ eratostene.cpp:12:5: error: 'vector' was not declared in this scope vector<bool> f(vmax + 1, 1); ^ eratostene.cpp:12:5: note: suggested alternative: In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from eratostene.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:210:11: note: 'std::vector' class vector : protected _Vector_base<_Tp, _Alloc> ^ In file included from /usr/include/c++/4.8/cstdbool:39:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:56, from eratostene.cpp:1: eratostene.cpp:12:12: error: expected primary-expression before 'bool' vector<bool> f(vmax + 1, 1); ^ eratostene.cpp:12:12: error: expected ';' before 'bool' eratostene.cpp:15:13: error: 'f' was not declared in this scope if (f[i]) ^ eratostene.cpp:28:13: error: 'f' was not declared in this scope if (f[x]) ^ eratostene.cpp:3:14: error: 'fout' was not declared in this scope #define cout fout ^ eratostene.cpp:33:5: note: in expansion of macro 'cout' cout << ans << '\n'; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Eratostene 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ă.