#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 | #55838781 | Utilizator | |
Fișier | combinari.cpp | Dimensiune | 774 B |
Data încărcării | 28 Ianuarie 2025, 10:54 | Scor / rezultat | Eroare de compilare |
combinari.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream g("combinari.out") ^ combinari.cpp: In function 'void init(int)': combinari.cpp:9:5: error: 's' was not declared in this scope s[k]=0; ^ combinari.cpp: In function 'int succesor(int)': combinari.cpp:13:8: error: 's' was not declared in this scope if(s[k]<n) ^ combinari.cpp:13:13: error: 'n' was not declared in this scope if(s[k]<n) ^ combinari.cpp: In function 'int valid(int)': combinari.cpp:23:12: error: 's' was not declared in this scope if(s[k]>=s[i]) return 0; ^ combinari.cpp: In function 'int solutie(int)': combinari.cpp:28:15: error: 'm' was not declared in this scope return k==m; ^ combinari.cpp: In function 'void afisare()': combinari.cpp:33:17: error: 'm' was not declared in this scope for(i=1; i<=m; i++) ^ combinari.cpp:34:9: error: 'g' was not declared in this scope g<<s[i]<< " "; ^ combinari.cpp:34:12: error: 's' was not declared in this scope g<<s[i]<< " "; ^ combinari.cpp:35:5: error: 'g' was not declared in this scope g<<endl; ^ combinari.cpp: In function 'void bck_aranj(int)': combinari.cpp:41:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k)) ^ combinari.cpp: In function 'int main()': combinari.cpp:47:8: error: 'n' was not declared in this scope f>>n>>m; ^ combinari.cpp:47:11: error: 'm' was not declared in this scope f>>n>>m; ^ combinari.cpp: In function 'int succesor(int)': combinari.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ combinari.cpp: In function 'int solutie(int)': combinari.cpp:29: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ă.