#197
Combinari
Se citesc două numere naturale nenule n
și k
. Să se afişeze, în ordine lexicografică, submulțimile de câte k
elemente ale mulţimii {1,2,..,n}
.
Problema | Combinari | Operații I/O |
combinari.in /combinari.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #26823156 | Utilizator | |
Fișier | combinari.cpp | Dimensiune | 1.05 KB |
Data încărcării | 17 Decembrie 2020, 17:39 | Scor / rezultat | Eroare de compilare |
combinari.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream out("combinari.out") ^ combinari.cpp: In function 'void init()': combinari.cpp:9:5: error: 'st' was not declared in this scope st[k]=0; ^ combinari.cpp:9:8: error: 'k' was not declared in this scope st[k]=0; ^ combinari.cpp: In function 'int succesor()': combinari.cpp:13:8: error: 'st' was not declared in this scope if(st[k]<n) ^ combinari.cpp:13:11: error: 'k' was not declared in this scope if(st[k]<n) ^ combinari.cpp:13:14: error: 'n' was not declared in this scope if(st[k]<n) ^ combinari.cpp: In function 'int e_valid()': combinari.cpp:22:9: error: 'k' was not declared in this scope if (k>1) ^ combinari.cpp:23:13: error: 'st' was not declared in this scope if (st[k-1]<st[k]) return 1; ^ combinari.cpp: In function 'int solutie()': combinari.cpp:29:8: error: 'k' was not declared in this scope if(k==m)return 1; ^ combinari.cpp:29:11: error: 'm' was not declared in this scope if(k==m)return 1; ^ combinari.cpp: In function 'void tipar()': combinari.cpp:35:16: error: 'k' was not declared in this scope for(i=1;i<=k;i++) ^ combinari.cpp:36:9: error: 'out' was not declared in this scope out<<st[i]<<" "; ^ combinari.cpp:36:14: error: 'st' was not declared in this scope out<<st[i]<<" "; ^ combinari.cpp:37:5: error: 'out' was not declared in this scope out<<endl; ^ combinari.cpp: In function 'void backtracking()': combinari.cpp:42:5: error: 'k' was not declared in this scope k=1; ^ combinari.cpp: In function 'int main()': combinari.cpp:66:11: error: 'n' was not declared in this scope in>>n; ^ combinari.cpp:67:10: error: 'm' was not declared in this scope in>>m; ^ combinari.cpp: In function 'int succesor()': combinari.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ combinari.cpp: In function 'int e_valid()': combinari.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ combinari.cpp: In function 'int solutie()': combinari.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Combinari 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ă.