#324
Se dă un număr natural n şi o mulţime cu m elemente, numere naturale nenule. Determinaţi, în ordine lexicografică, toate modalităţile de a-l scrie pe n ca sumă de termeni din acea mulţime.
| Problema | PartitiiNumar4 | Operații I/O |
partitiinumar4.in/partitiinumar4.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64108240 | Utilizator | |
| Fișier | partitiinumar4.cpp | Dimensiune | 628 B |
| Data încărcării | 17 Aprilie 2026, 12:18 | Scor/rezultat | Eroare de compilare |
partitiinumar4.cpp:3:1: error: ‘ifstream’ does not name a type 3 | ifstream fin("partitiinumar4.in"); | ^~~~~~~~ partitiinumar4.cpp:4:1: error: ‘ofstream’ does not name a type 4 | ofstream fout("partitiinumar4.out") | ^~~~~~~~ partitiinumar4.cpp: In function ‘void afisare(int)’: partitiinumar4.cpp:9:5: error: ‘fout’ was not declared in this scope 9 | fout<<a[i]<<' '; | ^~~~ partitiinumar4.cpp:9:11: error: ‘a’ was not declared in this scope 9 | fout<<a[i]<<' '; | ^ partitiinumar4.cpp:10:5: error: ‘fout’ was not declared in this scope 10 | fout<<endl; | ^~~~ partitiinumar4.cpp:10:11: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’? 10 | fout<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/13/istream:41, from /usr/include/c++/13/fstream:40, from partitiinumar4.cpp:1: /usr/include/c++/13/ostream:735:5: note: ‘std::endl’ declared here 735 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ partitiinumar4.cpp: In function ‘int verificare(int)’: partitiinumar4.cpp:13:10: error: ‘a’ was not declared in this scope 13 | {if(i>1&&a[i]<a[i-1]) | ^ partitiinumar4.cpp: In function ‘void back(int, int)’: partitiinumar4.cpp:19:18: error: ‘m’ was not declared in this scope 19 | { for(int j=1;j<=m;j++) | ^ partitiinumar4.cpp:20:2: error: ‘a’ was not declared in this scope 20 | {a[i]=b[j]; | ^ partitiinumar4.cpp:20:7: error: ‘b’ was not declared in this scope 20 | {a[i]=b[j]; | ^ partitiinumar4.cpp:21:12: error: ‘n’ was not declared in this scope 21 | if(sp+a[i]>n) | ^ partitiinumar4.cpp:24:14: error: ‘n’ was not declared in this scope 24 | {if(sp+a[i]==n) | ^ partitiinumar4.cpp: In function ‘int main()’: partitiinumar4.cpp:34:4: error: ‘fin’ was not declared in this scope 34 | fin>>n>>m; | ^~~ partitiinumar4.cpp:34:9: error: ‘n’ was not declared in this scope 34 | fin>>n>>m; | ^ partitiinumar4.cpp:34:12: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 34 | fin>>n>>m; | ^ | tm partitiinumar4.cpp:36:6: error: ‘b’ was not declared in this scope 36 | fin>>b[i]; | ^ partitiinumar4.cpp:38:11: error: expected ‘;’ before ‘fin’ 38 | back(1, 0) | ^ | ; 39 | fin.close(); | ~~~ partitiinumar4.cpp:40:5: error: ‘fout’ was not declared in this scope 40 | fout.close(); | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PartitiiNumar4 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ă.