#4491
Se citește un număr natural impar n (n<10). Afișați în ordine lexicografică toate permutările mulțimii {1,2,…,n} în care n se află în mijlocul permutării.
| Problema | permutari_11 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64267862 | Utilizator | |
| Fișier | permutari_11.cpp | Dimensiune | 603 B |
| Data încărcării | 27 Aprilie 2026, 11:28 | Scor/rezultat | 100 puncte |
permutari_11.cpp: In function ‘int valid(int)’: permutari_11.cpp:9:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 9 | if(v[i]==v[k])return 0;return 1; | ^~ permutari_11.cpp:9:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 9 | if(v[i]==v[k])return 0;return 1; | ^~~~~~ permutari_11.cpp:8:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(i=1;i<=k-1;i++) | ^~~ permutari_11.cpp:9:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 9 | if(v[i]==v[k])return 0;return 1; | ^~~~~~ permutari_11.cpp: In function ‘int solutie(int)’: permutari_11.cpp:13:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 13 | if(k==n) | ^~ permutari_11.cpp:14:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 14 | return 1;return 0; | ^~~~~~ permutari_11.cpp: In function ‘void afisare(int)’: permutari_11.cpp:19:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 19 | for(i=1;i<=k;i++)cout<<v[i]<<' ';cout<<'\n'; | ^~~ permutari_11.cpp:19:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 19 | for(i=1;i<=k;i++)cout<<v[i]<<' ';cout<<'\n'; | ^~~~ permutari_11.cpp: In function ‘void backt(int)’: permutari_11.cpp:28:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 28 | if(valid(k)==1) | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 20 | 20 | ||
| 3 | 0.001 secunde | OK. | 20 | 20 | ||
| 4 | 0.001 secunde | OK. | 20 | 20 | ||
| 5 | 0.022 secunde | OK. | 20 | 20 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema permutari_11 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ă.