#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 | #52241183 | Utilizator | |
Fișier | partitiinumar.cpp | Dimensiune | 775 B |
Data încărcării | 24 Septembrie 2024, 11:42 | 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:10:5: error: 's' was not declared in this scope s=0; ^ partitiinumar.cpp:12:12: error: 'st' was not declared in this scope s+=st[i]; ^ partitiinumar.cpp:13:10: error: 'n' was not declared in this scope if(s>n) ^ partitiinumar.cpp:16:12: error: 'st' was not declared in this scope if(st[k]<st[k-1]) ^ partitiinumar.cpp: In function 'void tipar(int)': partitiinumar.cpp:24:9: error: 'out' was not declared in this scope out<<st[i]<<" "; ^ partitiinumar.cpp:24:14: error: 'st' was not declared in this scope out<<st[i]<<" "; ^ partitiinumar.cpp:25:5: error: 'out' was not declared in this scope out<<"\n"; ^ partitiinumar.cpp: In function 'int solutie(int)': partitiinumar.cpp:30:8: error: 's' was not declared in this scope if(s==n) ^ partitiinumar.cpp:30:11: error: 'n' was not declared in this scope if(s==n) ^ partitiinumar.cpp: In function 'void back(int)': partitiinumar.cpp:37:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ partitiinumar.cpp:39:9: error: 'st' was not declared in this scope st[k]=i; ^ partitiinumar.cpp:40:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k)) ^ partitiinumar.cpp: In function 'int main()': partitiinumar.cpp:50:9: error: 'n' was not declared in this scope in>>n; ^
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ă.