#196
Se citesc două numere naturale nenule n și k. Să se afişeze, în ordine lexicografică, aranjamentele de câte k elemente ale mulţimii {1,2,..,n}.
| Problema | Aranjamente | Operații I/O |
aranjamente.in/aranjamente.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64294198 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 673 B |
| Data încărcării | 28 Aprilie 2026, 12:33 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp:4:1: error: expected ‘,’ or ‘;’ before ‘ifstream’ 4 | ifstream g("aranjamente.out") | ^~~~~~~~ aranjamente.cpp: In function ‘void Afis(int)’: aranjamente.cpp:10:8: error: ‘g’ was not declared in this scope 10 | g << x[j] << " "; | ^ aranjamente.cpp:10:13: error: ‘x’ was not declared in this scope 10 | g << x[j] << " "; | ^ aranjamente.cpp:11:2: error: ‘g’ was not declared in this scope 11 | g << endl; | ^ aranjamente.cpp: In function ‘bool OK(int)’: aranjamente.cpp:16:12: error: ‘x’ was not declared in this scope 16 | if(x[k] == x[i]) | ^ aranjamente.cpp: In function ‘bool Solutie(int)’: aranjamente.cpp:23:17: error: ‘p’ was not declared in this scope 23 | return k == p; | ^ aranjamente.cpp: In function ‘void Back(int)’: aranjamente.cpp:27:26: error: ‘n’ was not declared in this scope 27 | for(int i = 1 ; i <= n ; ++ i) | ^ aranjamente.cpp:29:9: error: ‘x’ was not declared in this scope 29 | x[k] = i; | ^ aranjamente.cpp:30:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 30 | if(OK(k)) | ^ aranjamente.cpp: In function ‘int main()’: aranjamente.cpp:38:9: error: ‘n’ was not declared in this scope 38 | f >> n >> p; | ^ aranjamente.cpp:38:14: error: ‘p’ was not declared in this scope 38 | f >> n >> p; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Aranjamente 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ă.