#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 | #55005700 | Utilizator | |
Fișier | partitiinumar.cpp | Dimensiune | 441 B |
Data încărcării | 16 Decembrie 2024, 10:39 | Scor / rezultat | Eroare de compilare |
partitiinumar.cpp:5:1: error: stray '\342' in program ifstream fin(“partitiinumar.in”); ^ partitiinumar.cpp:5:1: error: stray '\200' in program partitiinumar.cpp:5:1: error: stray '\234' in program partitiinumar.cpp:5:1: error: stray '\342' in program partitiinumar.cpp:5:1: error: stray '\200' in program partitiinumar.cpp:5:1: error: stray '\235' in program partitiinumar.cpp:6:1: error: stray '\342' in program ofstream fout(“partitiinumar.out”); ^ partitiinumar.cpp:6:1: error: stray '\200' in program partitiinumar.cpp:6:1: error: stray '\234' in program partitiinumar.cpp:6:1: error: stray '\342' in program partitiinumar.cpp:6:1: error: stray '\200' in program partitiinumar.cpp:6:1: error: stray '\235' in program partitiinumar.cpp:10:1: error: stray '\342' in program fout << x[i] << “ “; fout <<endl ; } void back(int k, int s) { for(int i=x[k-1] ; i<=n-s ;i++) { x[k]=i; if(s+x[k]<=n) if( s+x[k] == n ) ^ partitiinumar.cpp:10:1: error: stray '\200' in program partitiinumar.cpp:10:1: error: stray '\234' in program partitiinumar.cpp:10:1: error: stray '\342' in program partitiinumar.cpp:10:1: error: stray '\200' in program partitiinumar.cpp:10:1: error: stray '\234' in program partitiinumar.cpp:5:17: error: 'partitiinumar' was not declared in this scope ifstream fin(“partitiinumar.in”); ^ partitiinumar.cpp:6:18: error: 'partitiinumar' was not declared in this scope ofstream fout(“partitiinumar.out”); ^ partitiinumar.cpp: In function 'void afisare(int)': partitiinumar.cpp:10:9: error: 'x' was not declared in this scope fout << x[i] << “ “; fout <<endl ; } void back(int k, int s) { for(int i=x[k-1] ; i<=n-s ;i++) { x[k]=i; if(s+x[k]<=n) if( s+x[k] == n ) ^ partitiinumar.cpp:10:24: error: expected primary-expression before ';' token fout << x[i] << “ “; fout <<endl ; } void back(int k, int s) { for(int i=x[k-1] ; i<=n-s ;i++) { x[k]=i; if(s+x[k]<=n) if( s+x[k] == n ) ^ partitiinumar.cpp: In function 'void back(int, int)': partitiinumar.cpp:10:78: error: 'x' was not declared in this scope fout << x[i] << “ “; fout <<endl ; } void back(int k, int s) { for(int i=x[k-1] ; i<=n-s ;i++) { x[k]=i; if(s+x[k]<=n) if( s+x[k] == n ) ^ partitiinumar.cpp:10:112: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] fout << x[i] << “ “; fout <<endl ; } void back(int k, int s) { for(int i=x[k-1] ; i<=n-s ;i++) { x[k]=i; if(s+x[k]<=n) if( s+x[k] == n ) ^ partitiinumar.cpp: In function 'int main()': partitiinumar.cpp:12:62: error: 'x0' was not declared in this scope afisare(k); else back(k+1, s+x[k]); } } int main() { fin>>n; x0=1; back(1,0); return 0; } ^
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ă.