#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 | #53517012 | Utilizator | |
Fișier | combinari.cpp | Dimensiune | 786 B |
Data încărcării | 04 Noiembrie 2024, 08:10 | Scor / rezultat | Eroare de compilare |
combinari.cpp:7:1: error: expected ',' or ';' before 'ofstream' ofstream fout("combinari.out") ^ combinari.cpp: In function 'void Afis(int)': combinari.cpp:14:9: error: 'fout' was not declared in this scope fout << x[j] << " "; ^ combinari.cpp:14:17: error: 'x' was not declared in this scope fout << x[j] << " "; ^ combinari.cpp:15:5: error: 'fout' was not declared in this scope fout << endl; ^ combinari.cpp: In function 'bool OK(int)': combinari.cpp:20:12: error: 'x' was not declared in this scope if(x[k] == x[i]) ^ combinari.cpp:23:12: error: 'x' was not declared in this scope if(x[k] <= x[k-1]) ^ combinari.cpp: In function 'bool Solutie(int)': combinari.cpp:30:17: error: 'p' was not declared in this scope return k == p; ^ combinari.cpp: In function 'void back(int)': combinari.cpp:34:26: error: 'n' was not declared in this scope for(int i = 1 ; i <= n ; ++ i) ^ combinari.cpp:36:9: error: 'x' was not declared in this scope x[k] = i; ^ combinari.cpp:37:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(OK(k)) ^ combinari.cpp: In function 'int main()': combinari.cpp:45:12: error: 'n' was not declared in this scope fin >> n >> p; ^ combinari.cpp:45:17: error: 'p' was not declared in this scope fin >> n >> p; ^ combinari.cpp: In function 'bool Solutie(int)': 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ă.