#130
Să se scrie un program care ordonează elementele unui vector crescător după suma cifrelor.
| Problema | SortCif | Operații I/O |
sortcif.in/sortcif.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64426163 | Utilizator | |
| Fișier | sortcif.cpp | Dimensiune | 489 B |
| Data încărcării | 06 Mai 2026, 11:56 | Scor/rezultat | Eroare de compilare |
sortcif.cpp: In function ‘int main()’: sortcif.cpp:9:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 9 | for(i=1; i<n; i++) | ^~~ sortcif.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | c=v[i]; s=0; | ^ sortcif.cpp:11:10: error: incompatible types in assignment of ‘int’ to ‘int [100000]’ 11 | c=v[i]; s=0; | ~^~~~~ sortcif.cpp:11:17: error: ‘s’ was not declared in this scope 11 | c=v[i]; s=0; | ^ sortcif.cpp:12:15: warning: the address of ‘c’ will never be NULL [-Waddress] 12 | while(c) | ^ sortcif.cpp:5:15: note: ‘c’ declared here 5 | int v[100000],c[100000],a[1001],b[100000],n,m,sortat,i,k,j,x,p,u,poz; | ^ sortcif.cpp:14:17: error: invalid operands of types ‘int [100000]’ and ‘int’ to binary ‘operator%’ 14 | s+=c%10; | ~^~~ | | | | | int | int [100000] sortcif.cpp:15:14: error: invalid operands of types ‘int [100000]’ and ‘int’ to binary ‘operator/’ 15 | c/=10; | ~^~~~ sortcif.cpp:15:14: note: in evaluation of ‘operator/=(int [100000], int)’ sortcif.cpp:20:24: error: expected ‘;’ before ‘}’ token 20 | swap(v[j],v[i])} | ^ | ; sortcif.cpp:18:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 18 | for(j=i+1;j<=n; j++) | ^~~ sortcif.cpp:21:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 21 | for(i=1;i<n;i++) | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SortCif 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ă.