#803
NrSufix
Fiind date două numere a
şi b
, îl numim pe a
sufix al lui b
dacă a
este egal cu b
sau dacă b
se poate obţine din a prin alipirea la stânga a unor noi cifre.
Se dă un număr natural x
și un șir de numere naturale. Să se determine ultimul număr din șir care îl care ca sufix pe x
.
Variante Bacalaureat 2013
Problema | NrSufix | Operații I/O |
nrsufix.in /nrsufix.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
Id soluție | #53130311 | Utilizator | |
Fișier | nrsufix.cpp | Dimensiune | 326 B |
Data încărcării | 18 Octombrie 2024, 13:21 | Scor / rezultat | Eroare de compilare |
nrsufix.cpp: In function 'int main()': nrsufix.cpp:6:3: error: 'ifstream' was not declared in this scope { ifstream cin ("nrsufix.in"); ^ nrsufix.cpp:6:3: 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/fstream:38, from nrsufix.cpp:2: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ nrsufix.cpp:6:13: error: expected ';' before 'cin' { ifstream cin ("nrsufix.in"); ^ nrsufix.cpp:7:1: error: 'ofstream' was not declared in this scope ofstream cout ("nrsufix.out"); ^ nrsufix.cpp:7:1: 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/fstream:38, from nrsufix.cpp:2: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ nrsufix.cpp:7:10: error: expected ';' before 'cout' ofstream cout ("nrsufix.out"); ^ nrsufix.cpp:9:1: error: 'cin' was not declared in this scope cin>> n; ^ nrsufix.cpp:9:1: note: suggested alternative: In file included from nrsufix.cpp:3:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ nrsufix.cpp:11:35: error: expected ';' before '}' token while (cn>0) {put=put*10; cn=cn/10} ^ nrsufix.cpp:12:13: error: 'a' was not declared in this scope while (cin>>a) ^ nrsufix.cpp:17:15: error: 'cout' was not declared in this scope if (ult==-1) cout<<"nu exista"; ^ nrsufix.cpp:17:15: note: suggested alternative: In file included from nrsufix.cpp:3:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ nrsufix.cpp:18:7: error: 'cout' was not declared in this scope else cout<< ult; ^ nrsufix.cpp:18:7: note: suggested alternative: In file included from nrsufix.cpp:3:0: /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 NrSufix 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ă.