#204
Siruri
Se citesc două numere naturale nenule n
și m
. Să se determine toate şirurile cu m
elemente din mulţimea {1,2,..,n}
, ordonate strict crescător, cu proprietatea că oricare două elemente consecutive în şir au diferenţa mai mică sau egală cu cu 2
.
Problema | Siruri | Operații I/O |
siruri.in /siruri.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54357382 | Utilizator | |
Fișier | siruri.cpp | Dimensiune | 814 B |
Data încărcării | 26 Noiembrie 2024, 15:40 | Scor / rezultat | Eroare de compilare |
siruri.cpp:4:11: error: expected unqualified-id before string constant ifstream("siruri.in"); ^ siruri.cpp:4:11: error: expected ')' before string constant siruri.cpp:7:1: error: expected ',' or ';' before 'int' int sol[100], n,m; ^ siruri.cpp: In function 'void init(int)': siruri.cpp:11:4: error: 'sol' was not declared in this scope { sol[k]=0; ^ siruri.cpp: In function 'int succesor(int)': siruri.cpp:15:8: error: 'sol' was not declared in this scope { if (sol[k]<n) ^ siruri.cpp:15:15: error: 'n' was not declared in this scope { if (sol[k]<n) ^ siruri.cpp: In function 'int valid(int)': siruri.cpp:22:9: error: 'sol' was not declared in this scope if(sol[i]==sol[k]) ^ siruri.cpp:24:19: error: 'sol' was not declared in this scope if(k>1 && sol[k]-sol[k-1]>2) ^ siruri.cpp:26:19: error: 'sol' was not declared in this scope if(k>1 && sol[k-1]>sol[k]) ^ siruri.cpp: In function 'int solutie(int)': siruri.cpp:32:14: error: 'm' was not declared in this scope { return k==m; ^ siruri.cpp: In function 'void afisare(int)': siruri.cpp:36:29: error: 'sol' was not declared in this scope { for(int i=1;i<=k;i++) g<<sol[i]<<" "; ^ siruri.cpp: In function 'void back(int)': siruri.cpp:43:10: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k)) ^ siruri.cpp: In function 'int main()': siruri.cpp:49:4: error: 'f' was not declared in this scope { f>>n>>m; ^ siruri.cpp:49:7: error: 'n' was not declared in this scope { f>>n>>m; ^ siruri.cpp:49:10: error: 'm' was not declared in this scope { f>>n>>m; ^ siruri.cpp: In function 'int succesor(int)': siruri.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ siruri.cpp: In function 'int solutie(int)': siruri.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Siruri 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ă.