#197
Se citesc două numere naturale nenule n și k. Să se afişeze, în ordine lexicografică, submulțimile de câte k elemente ale mulţimii {1,2,..,n}.
| Problema | Combinari | Operații I/O |
combinari.in/combinari.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64215751 | Utilizator | |
| Fișier | combinari.cpp | Dimensiune | 445 B |
| Data încărcării | 23 Aprilie 2026, 11:51 | Scor/rezultat | 0 puncte |
combinari.cpp: In function ‘void back(int)’: combinari.cpp:15:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 15 | if(k=p+1) | ~^~~~ combinari.cpp: In function ‘void back(int)’: combinari.cpp:18:24: warning: array subscript -1 is below array bounds of ‘int [16]’ [-Warray-bounds=] 18 | for(int i=s[k-1]+1; i<=n-p+k;i++) | ~~~~~^ combinari.cpp:6:5: note: while referencing ‘s’ 6 | int s[16], n,p; | ^ In function ‘void back(int)’, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13: combinari.cpp:18:24: warning: array subscript -1 is below array bounds of ‘int [16]’ [-Warray-bounds=] 18 | for(int i=s[k-1]+1; i<=n-p+k;i++) | ~~~~~^ combinari.cpp: In function ‘void back(int)’: combinari.cpp:6:5: note: while referencing ‘s’ 6 | int s[16], n,p; | ^ In function ‘void back(int)’, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13: combinari.cpp:18:24: warning: array subscript -1 is below array bounds of ‘int [16]’ [-Warray-bounds=] 18 | for(int i=s[k-1]+1; i<=n-p+k;i++) | ~~~~~^ combinari.cpp: In function ‘void back(int)’: combinari.cpp:6:5: note: while referencing ‘s’ 6 | int s[16], n,p; | ^ In function ‘void back(int)’, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13: combinari.cpp:18:24: warning: array subscript -1 is below array bounds of ‘int [16]’ [-Warray-bounds=] 18 | for(int i=s[k-1]+1; i<=n-p+k;i++) | ~~~~~^ combinari.cpp: In function ‘void back(int)’: combinari.cpp:6:5: note: while referencing ‘s’ 6 | int s[16], n,p; | ^ In function ‘void back(int)’, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13, inlined from ‘void back(int)’ at combinari.cpp:13:6, inlined from ‘void back(int)’ at combinari.cpp:21:13: combinari.cpp:18:24: warning: array subscript -1 is below array bounds of ‘int [16]’ [-Warray-bounds=] 18 | for(int i=s[k-1]+1; i<=n-p+k;i++) | ~~~~~^ combinari.cpp: In function ‘void back(int)’: combinari.cpp:6:5: note: while referencing ‘s’ 6 | int s[16], n,p; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 30 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 30 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Combinari 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ă.