#2812
Progresie3
Se dă un șir de cel mult 10
6
numere naturale din intervalul [0,10
3
]
. Se cere să se verifice dacă există un număr natural r
, astfel încât toate numerele distincte din șir să poată fi rearanjate, pentru a forma o progresie aritmetică de rație r
. Se afișează numărul r
, sau mesajul NU
, dacă nu există un astfel de număr.
Subiect Bacalaureat 2017, sesiune august-septembrie
Problema | Progresie3 | Operații I/O |
progresie3.in /progresie3.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49937929 | Utilizator | |
Fișier | progresie3.cpp | Dimensiune | 511 B |
Data încărcării | 20 Martie 2024, 14:54 | Scor / rezultat | Eroare de compilare |
progresie3.cpp:2:1: error: 'usign' does not name a type usign namespace std; ^ progresie3.cpp: In function 'int main()': progresie3.cpp:5:6: error: 'ifstream' was not declared in this scope { ifstream cin("progresie3.in"); ^ progresie3.cpp:5:6: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from progresie3.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ progresie3.cpp:5:15: error: expected ';' before 'cin' { ifstream cin("progresie3.in"); ^ progresie3.cpp:6:6: error: 'ofstream' was not declared in this scope ofstream cout("progresie3.out"); ^ progresie3.cpp:6:6: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from progresie3.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ progresie3.cpp:6:15: error: expected ';' before 'cout' ofstream cout("progresie3.out"); ^ progresie3.cpp:8:12: error: 'cin' was not declared in this scope while(cin>>x) ^ progresie3.cpp:8:12: note: suggested alternative: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from progresie3.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ progresie3.cpp:26:6: error: 'cout' was not declared in this scope cout<<r; ^ progresie3.cpp:26:6: note: suggested alternative: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from progresie3.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ progresie3.cpp:28:6: error: 'cout' was not declared in this scope cout<<"NU"; ^ progresie3.cpp:28:6: note: suggested alternative: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from progresie3.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Progresie3 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ă.