#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 | #64294301 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 1.25 KB |
| Data încărcării | 28 Aprilie 2026, 12:35 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp:5:1: error: expected ‘,’ or ‘;’ before ‘ofstrem’ 5 | ofstrem out("aranjamente.out") | ^~~~~~~ aranjamente.cpp: In function ‘void Afis(int)’: aranjamente.cpp:11:9: error: ‘out’ was not declared in this scope 11 | out << x[j] << " "; | ^~~ aranjamente.cpp:11:16: error: ‘x’ was not declared in this scope 11 | out << x[j] << " "; | ^ aranjamente.cpp:12:5: error: ‘out’ was not declared in this scope 12 | out << endl; | ^~~ aranjamente.cpp: In function ‘bool OK(int)’: aranjamente.cpp:17:12: error: ‘x’ was not declared in this scope 17 | if(x[k] == x[i]) | ^ aranjamente.cpp: In function ‘bool Solutie(int)’: aranjamente.cpp:24:17: error: ‘p’ was not declared in this scope 24 | return k == p; | ^ aranjamente.cpp: In function ‘void Back(int)’: aranjamente.cpp:28:26: error: ‘n’ was not declared in this scope 28 | for(int i = 1 ; i <= n ; ++ i) | ^ aranjamente.cpp:30:9: error: ‘x’ was not declared in this scope 30 | x[k] = i; | ^ aranjamente.cpp:31:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 31 | if(OK(k)) | ^ aranjamente.cpp: In function ‘int main()’: aranjamente.cpp:39:11: error: ‘n’ was not declared in this scope; did you mean ‘in’? 39 | in >> n >> p; | ^ | in aranjamente.cpp:39:16: error: ‘p’ was not declared in this scope 39 | in >> n >> p; | ^ aranjamente.cpp: At global scope: aranjamente.cpp:45:6: error: redefinition of ‘void Afis(int)’ 45 | void Afis(int k) | ^~~~ aranjamente.cpp:8:6: note: ‘void Afis(int)’ previously defined here 8 | void Afis(int k) | ^~~~ aranjamente.cpp: In function ‘void Afis(int)’: aranjamente.cpp:48:9: error: ‘out’ was not declared in this scope 48 | out << x[j] << " "; | ^~~ aranjamente.cpp:49:5: error: ‘out’ was not declared in this scope 49 | out << endl; | ^~~ aranjamente.cpp: At global scope: aranjamente.cpp:52:6: error: redefinition of ‘bool OK(int)’ 52 | bool OK(int k){ | ^~ aranjamente.cpp:15:6: note: ‘bool OK(int)’ previously defined here 15 | bool OK(int k){ | ^~ aranjamente.cpp:59:6: error: redefinition of ‘bool Solutie(int)’ 59 | bool Solutie(int k) | ^~~~~~~ aranjamente.cpp:22:6: note: ‘bool Solutie(int)’ previously defined here 22 | bool Solutie(int k) | ^~~~~~~ aranjamente.cpp:64:6: error: redefinition of ‘void Back(int)’ 64 | void Back(int k){ | ^~~~ aranjamente.cpp:27:6: note: ‘void Back(int)’ previously defined here 27 | void Back(int k){ | ^~~~ aranjamente.cpp: In function ‘void Back(int)’: aranjamente.cpp:68:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 68 | if(OK(k)) | ^ aranjamente.cpp: At global scope: aranjamente.cpp:75:5: error: redefinition of ‘int main()’ 75 | int main(){ | ^~~~ aranjamente.cpp:38:5: note: ‘int main()’ previously defined here 38 | int main(){ | ^~~~
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ă.