#3481
Se dau n numere naturale. Să se afișeze acestea în ordinea crescătoare a numărului de divizori ai fiecăruia, la același număr de divizori crescător după cifra de control, la aceeași cifră de control crescător după prima cifră, iar dacă și prima cifră este aceeași atunci numerele se vor afișa în ordinea crescătoare a valorii lor.
| Problema | sort_div | Operații I/O |
sort_div.in/sort_div.out
|
|---|---|---|---|
| Limita timp | 0.02 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
| Id soluție | #64459804 | Utilizator | |
| Fișier | sort_div.cpp | Dimensiune | 965 B |
| Data încărcării | 08 Mai 2026, 08:40 | Scor/rezultat | Eroare de compilare |
sort_div.cpp:14:29: error: expected ‘,’ or ‘...’ before ‘.’ token 14 | void nrdivizori(int n, int&a.nrdiv) | ^ sort_div.cpp: In function ‘void nrdivizori(int, int&)’: sort_div.cpp:18:13: error: invalid types ‘int[int]’ for array subscript 18 | if(a[i]%i==0) | ^ sort_div.cpp:19:14: error: invalid types ‘int[int]’ for array subscript 19 | a[i].nrdiv+=2; | ^ sort_div.cpp:20:24: error: invalid types ‘int[int]’ for array subscript 20 | else if (i*i==a[i]) | ^ sort_div.cpp:21:14: error: invalid types ‘int[int]’ for array subscript 21 | a[i].nrdiv++; | ^ sort_div.cpp: At global scope: sort_div.cpp:24:43: error: expected ‘,’ or ‘...’ before ‘%’ token 24 | void cifracontrol(int n, int a[10001], int%a.cc) | ^ sort_div.cpp: In function ‘void cifracontrol(int, int*, int)’: sort_div.cpp:28:20: error: request for member ‘n’ in ‘*(a + ((sizetype)(((long unsigned int)i) * 4)))’, which is of non-class type ‘int’ 28 | int r=a[i].n%9; | ^ sort_div.cpp:30:18: error: request for member ‘cc’ in ‘*(a + ((sizetype)(((long unsigned int)i) * 4)))’, which is of non-class type ‘int’ 30 | a[i].cc=9; | ^~ sort_div.cpp:32:18: error: request for member ‘cc’ in ‘*(a + ((sizetype)(((long unsigned int)i) * 4)))’, which is of non-class type ‘int’ 32 | a[i].cc=r; | ^~ sort_div.cpp: In function ‘void sortare(int&, int*)’: sort_div.cpp:37:5: error: ‘nrdiv’ was not declared in this scope 37 | nrdiv=nrdivizori(n,a); | ^~~~~ sort_div.cpp:37:24: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive] 37 | nrdiv=nrdivizori(n,a); | ^ | | | int* sort_div.cpp:14:28: note: initializing argument 2 of ‘void nrdivizori(int, int&)’ 14 | void nrdivizori(int n, int&a.nrdiv) | ~~~~^ sort_div.cpp:37:24: error: cannot bind rvalue ‘(int)a’ to ‘int&’ 37 | nrdiv=nrdivizori(n,a); | ^ sort_div.cpp:38:8: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 38 | if(int i=1; i<=n; i++) | ^~~ sort_div.cpp:38:21: error: expected ‘)’ before ‘;’ token 38 | if(int i=1; i<=n; i++) | ~ ^ | ) sort_div.cpp:38:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 38 | if(int i=1; i<=n; i++) | ^~ sort_div.cpp:38:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 38 | if(int i=1; i<=n; i++) | ^ sort_div.cpp:38:23: error: ‘i’ was not declared in this scope sort_div.cpp:39:23: error: ‘j’ was not declared in this scope 39 | if(int j=i+1; j<=n; j++) | ^ sort_div.cpp:47:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 47 | int main() | ^~ sort_div.cpp:47:9: note: remove parentheses to default-initialize a variable 47 | int main() | ^~ | -- sort_div.cpp:47:9: note: or replace parentheses with braces to value-initialize a variable sort_div.cpp:48:1: error: a function-definition is not allowed here before ‘{’ token 48 | { | ^ sort_div.cpp:51:2: error: expected ‘}’ at end of input 51 | } | ^ sort_div.cpp:36:1: note: to match this ‘{’ 36 | { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sort_div 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ă.