#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 | #64079959 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 687 B |
| Data încărcării | 16 Aprilie 2026, 05:50 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp: In function ‘void afis(int)’: aranjamente.cpp:12:6: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 12 | for(int i=1;i<=m;i++) g<<x[i]<<" "; /la aranjamente, k e de la 1 la m | ^~~ aranjamente.cpp:12:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 12 | for(int i=1;i<=m;i++) g<<x[i]<<" "; /la aranjamente, k e de la 1 la m | ^ aranjamente.cpp:12:42: error: expected primary-expression before ‘/’ token aranjamente.cpp:12:43: error: ‘la’ was not declared in this scope 12 | for(int i=1;i<=m;i++) g<<x[i]<<" "; /la aranjamente, k e de la 1 la m | ^~ aranjamente.cpp: In function ‘int valid(int)’: aranjamente.cpp:20:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 20 | if(x[k]==x[i]) return 0; / trebuie sa fie elemente distincte | ^~ aranjamente.cpp:20:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 20 | if(x[k]==x[i]) return 0; / trebuie sa fie elemente distincte | ^ aranjamente.cpp:19:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 19 | for(i=1;i<k;i++) | ^~~ aranjamente.cpp:20:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 20 | if(x[k]==x[i]) return 0; / trebuie sa fie elemente distincte | ^ aranjamente.cpp:20:34: error: expected primary-expression before ‘/’ token aranjamente.cpp:20:36: error: ‘trebuie’ was not declared in this scope 20 | if(x[k]==x[i]) return 0; / trebuie sa fie elemente distincte | ^~~~~~~ aranjamente.cpp: In function ‘void bkt(int)’: aranjamente.cpp:31:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 31 | if(k==m) afis(k); / daca s a ajuns la o solutie(diferenta fata de permutari) | ^~ aranjamente.cpp:31:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 31 | if(k==m) afis(k); / daca s a ajuns la o solutie(diferenta fata de permutari) | ^ aranjamente.cpp:30:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 30 | if(valid(k)) | ^~ aranjamente.cpp:31:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 31 | if(k==m) afis(k); / daca s a ajuns la o solutie(diferenta fata de permutari) | ^ aranjamente.cpp:31:31: error: expected primary-expression before ‘/’ token aranjamente.cpp:31:33: error: ‘daca’ was not declared in this scope 31 | if(k==m) afis(k); / daca s a ajuns la o solutie(diferenta fata de permutari) | ^~~~ aranjamente.cpp: In function ‘int valid(int)’: aranjamente.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type] 22 | } | ^
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ă.