#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 | #64294141 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 700 B |
| Data încărcării | 28 Aprilie 2026, 12:32 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp:5:1: error: expected ‘,’ or ‘;’ before ‘ofstream’ 5 | ofstream out("aranjamente.out") | ^~~~~~~~ aranjamente.cpp: In function ‘void Afis(int)’: aranjamente.cpp:12:9: error: ‘cout’ was not declared in this scope 12 | cout << x[j] << " "; | ^~~~ aranjamente.cpp:2:1: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? 1 | #include <fstream> +++ |+#include <iostream> 2 | using namespace std; aranjamente.cpp:12:17: error: ‘x’ was not declared in this scope 12 | cout << x[j] << " "; | ^ aranjamente.cpp:13:5: error: ‘cout’ was not declared in this scope 13 | cout << endl; | ^~~~ aranjamente.cpp:13:5: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? aranjamente.cpp: In function ‘bool OK(int)’: aranjamente.cpp:18:12: error: ‘x’ was not declared in this scope 18 | if(x[k] == x[i]) | ^ aranjamente.cpp: In function ‘bool Solutie(int)’: aranjamente.cpp:25:17: error: ‘p’ was not declared in this scope 25 | return k == p; | ^ aranjamente.cpp: In function ‘void Back(int)’: aranjamente.cpp:29:26: error: ‘n’ was not declared in this scope 29 | for(int i = 1 ; i <= n ; ++ i) | ^ aranjamente.cpp:31:9: error: ‘x’ was not declared in this scope 31 | x[k] = i; | ^ aranjamente.cpp:32:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 32 | if(OK(k)) | ^ aranjamente.cpp: In function ‘int main()’: aranjamente.cpp:40:5: error: ‘cin’ was not declared in this scope 40 | cin >> n >> p; | ^~~ aranjamente.cpp:40:5: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? aranjamente.cpp:40:12: error: ‘n’ was not declared in this scope; did you mean ‘in’? 40 | cin >> n >> p; | ^ | in aranjamente.cpp:40:17: error: ‘p’ was not declared in this scope 40 | cin >> 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ă.