#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 | #64294102 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 665 B |
| Data încărcării | 28 Aprilie 2026, 12:31 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp:7:5: error: expected ‘,’ or ‘;’ before ‘ofstream’ 7 | ofstream g (" aranjamente.out") | ^~~~~~~~ aranjamente.cpp: In function ‘void Afis()’: aranjamente.cpp:13:21: error: ‘n’ was not declared in this scope 13 | for( int j=1;j<=n;j++) | ^ aranjamente.cpp:14:9: error: ‘g’ was not declared in this scope 14 | g<<x[j]<<" "; | ^ aranjamente.cpp:14:12: error: ‘x’ was not declared in this scope 14 | g<<x[j]<<" "; | ^ aranjamente.cpp:15:5: error: ‘g’ was not declared in this scope 15 | g<<endl; | ^ aranjamente.cpp: In function ‘bool OK(int)’: aranjamente.cpp:20:12: error: ‘x’ was not declared in this scope 20 | if(x[k]==x[i]) | ^ aranjamente.cpp: In function ‘bool Solutie(int)’: aranjamente.cpp:27:17: error: ‘n’ was not declared in this scope 27 | return k == n; | ^ aranjamente.cpp: In function ‘void back(int)’: aranjamente.cpp:31:22: error: ‘n’ was not declared in this scope 31 | for(int i=1 ; i<=n ; ++i) | ^ aranjamente.cpp:33:9: error: ‘x’ was not declared in this scope 33 | x[k]=i; | ^ aranjamente.cpp:34:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 34 | if( OK(k) ) | ^ aranjamente.cpp: In function ‘int main()’: aranjamente.cpp:42:8: error: ‘n’ was not declared in this scope 42 | f>>n; | ^
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ă.