#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 | #62434682 | Utilizator | |
| Fișier | aranjamente.cpp | Dimensiune | 718 B |
| Data încărcării | 21 Ianuarie 2026, 13:14 | Scor/rezultat | Eroare de compilare |
aranjamente.cpp:6:1: error: expected ',' or ';' before 'ofstream' ofstream cout("aranjamente.out") ^ aranjamente.cpp: In function 'void Afis(int)': aranjamente.cpp:13:17: error: 'x' was not declared in this scope cout << x[j] << " "; ^ aranjamente.cpp: In function 'bool OK(int)': aranjamente.cpp:19:12: error: 'x' was not declared in this scope if(x[k] == x[i]) ^ aranjamente.cpp: In function 'bool Solutie(int)': aranjamente.cpp:26:17: error: 'p' was not declared in this scope return k == p; ^ aranjamente.cpp: In function 'void Back(int)': aranjamente.cpp:30:26: error: 'n' was not declared in this scope for(int i = 1 ; i <= n ; ++ i) ^ aranjamente.cpp:32:9: error: 'x' was not declared in this scope x[k] = i; ^ aranjamente.cpp:33:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(OK(k)) ^ aranjamente.cpp: In function 'int main()': aranjamente.cpp:41:5: error: reference to 'cin' is ambiguous cin >> n >> p; ^ aranjamente.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("aranjamente.in") ^ In file included from aranjamente.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ aranjamente.cpp:41:12: error: 'n' was not declared in this scope cin >> n >> p; ^ aranjamente.cpp:41:17: error: 'p' was not declared in this scope cin >> n >> p; ^ aranjamente.cpp: In function 'bool Solutie(int)': aranjamente.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.