#320
PartitiiNumar
Se dă un număr natural n
. Determinaţi, în ordine lexicografică, toate modalităţile de a-l scrie pe n
ca sumă de numere naturale.
Problema | PartitiiNumar | Operații I/O |
partitiinumar.in /partitiinumar.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #52241087 | Utilizator | |
Fișier | partitiinumar.cpp | Dimensiune | 728 B |
Data încărcării | 24 Septembrie 2024, 11:41 | Scor / rezultat | Eroare de compilare |
partitiinumar.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream out("partitiinumar.out") ^ partitiinumar.cpp: In function 'int valid(int)': partitiinumar.cpp:9:5: error: 's' was not declared in this scope s=0; ^ partitiinumar.cpp:11:12: error: 'st' was not declared in this scope s+=st[i]; ^ partitiinumar.cpp:12:10: error: 'n' was not declared in this scope if(s>n) ^ partitiinumar.cpp:15:16: error: 'st' was not declared in this scope if(st[k]<st[k-1]) ^ partitiinumar.cpp: In function 'void tipar(int)': partitiinumar.cpp:21:3: error: 'out' was not declared in this scope out<<st[i]<<" "; ^ partitiinumar.cpp:21:8: error: 'st' was not declared in this scope out<<st[i]<<" "; ^ partitiinumar.cpp:22:5: error: 'out' was not declared in this scope out<<"\n"; ^ partitiinumar.cpp: In function 'int solutie(int)': partitiinumar.cpp:26:8: error: 's' was not declared in this scope if(s==n) ^ partitiinumar.cpp:26:11: error: 'n' was not declared in this scope if(s==n) ^ partitiinumar.cpp: In function 'void back(int)': partitiinumar.cpp:32:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ partitiinumar.cpp:34:9: error: 'st' was not declared in this scope st[k]=i; ^ partitiinumar.cpp:35:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k)) ^ partitiinumar.cpp: In function 'int main()': partitiinumar.cpp:45:9: error: 'n' was not declared in this scope in>>n; ^ partitiinumar.cpp: In function 'int valid(int)': partitiinumar.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PartitiiNumar 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ă.