#1903
Andrei a făcut într-o zi un șir de N numere. În a doua zi a lăsat în acel șir doar numerele prime. În a treia zi a calculat pentru fiecare număr rămas în șir suma cifrelor, iar apoi a adunat toate aceste sume în S. După ce a obținut numărul S a început să adune toate cifrele din care este format S și tot așa până când ajunge la o cifră terminală C.
| Problema | vterminal | Operații I/O |
vterminal.in/vterminal.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0 MB
|
| Id soluție | #63700920 | Utilizator | |
| Fișier | vterminal.cpp | Dimensiune | 796 B |
| Data încărcării | 15 Martie 2026, 22:14 | Scor/rezultat | Eroare de compilare |
vterminal.cpp: In function 'int main()': vterminal.cpp:6:10: error: 'n' was not declared in this scope fin>>n; ^ vterminal.cpp:8:32: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' for(int i=0;i<n;i++) {fin>>x; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from vterminal.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [100]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ vterminal.cpp:9:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] while(x>1000) fin>>x;} ^ vterminal.cpp:9:22: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' while(x>1000) fin>>x;} ^ In file included from /usr/include/c++/4.8/fstream:38:0, from vterminal.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [100]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ vterminal.cpp:11:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(x < 2) p=1; ^ vterminal.cpp:12:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] for(int j = 2; j*j <= x && p; j++) { ^ vterminal.cpp:13:20: error: invalid operands of types 'int [100]' and 'int' to binary 'operator%' if(x % j == 0) p=1; ^ vterminal.cpp:16:28: error: invalid conversion from 'int*' to 'int' [-fpermissive] int s = 0, y = x; ^ vterminal.cpp:21:13: error: 'S' was not declared in this scope S += s; ^ vterminal.cpp: At global scope: vterminal.cpp:24:13: error: 'S' was not declared in this scope int C = S; ^ vterminal.cpp:25:5: error: expected unqualified-id before 'while' while(C >= 10) { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema vterminal 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ă.