#319
suma35
Se dă un număr natural nenul n
. Să se determine toate modalităţile distincte de descompunere a numărului n
în sumă de 3
şi 5
.
Problema | suma35 | Operații I/O |
suma35.in /suma35.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50440342 | Utilizator | |
Fișier | suma35.cpp | Dimensiune | 683 B |
Data încărcării | 09 Aprilie 2024, 18:39 | Scor / rezultat | Eroare de compilare |
suma35.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout("suma35.out") ^ suma35.cpp: In function 'void afisare(int)': suma35.cpp:9:20: error: 'sk' was not declared in this scope for(int i=1;i<=sk[1];i++) ^ suma35.cpp:10:5: error: 'fout' was not declared in this scope fout<<3<<" "; ^ suma35.cpp:11:21: error: 'sk' was not declared in this scope for(int i=1;i<=sk[2];i++) ^ suma35.cpp:12:5: error: 'fout' was not declared in this scope fout<<5<<" "; ^ suma35.cpp:13:5: error: 'fout' was not declared in this scope fout<<'\n'; ^ suma35.cpp: In function 'int valid(int, int)': suma35.cpp:18:10: error: 'n' was not declared in this scope if(s>n) return 0; ^ suma35.cpp:19:19: error: 'n' was not declared in this scope if(k==2 && s!=n) return 0; ^ suma35.cpp:17:9: warning: unused variable 'i' [-Wunused-variable] int i; ^ suma35.cpp: In function 'void back(int, int)': suma35.cpp:25:10: error: 'n' was not declared in this scope for(i=n/3;i>=0;i--) ^ suma35.cpp:27:8: error: 'st' was not declared in this scope st[k]=-i; ^ suma35.cpp:28:21: error: 'a' was not declared in this scope if(valid(k,s+a[k]*st[k])) ^ suma35.cpp:30:30: error: 'stk' was not declared in this scope else back(k+1,s+a[k]*stk]);} ^ suma35.cpp:30:33: error: expected ';' before ']' token else back(k+1,s+a[k]*stk]);} ^ suma35.cpp:28:10: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k,s+a[k]*st[k])) ^ suma35.cpp: In function 'int main()': suma35.cpp:36:12: error: 'n' was not declared in this scope fin >> n;a[1]=3; ^ suma35.cpp:36:14: error: 'a' was not declared in this scope fin >> n;a[1]=3; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema suma35 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ă.