#376
Se citește un număr natural n. Să se determine suma divizorilor săi.
| Problema | Suma Divizori | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64323976 | Utilizator | |
| Fișier | suma_divizori.cpp | Dimensiune | 286 B |
| Data încărcării | 29 Aprilie 2026, 17:27 | Scor/rezultat | Eroare de compilare |
suma_divizori.cpp: In function ‘int main()’: suma_divizori.cpp:9:21: error: expected ‘)’ before ‘;’ token 9 | for ( d=2; d<sqrt(n;d++) | ~ ^ | ) suma_divizori.cpp:9:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 9 | for ( d=2; d<sqrt(n;d++) | ^~~ suma_divizori.cpp:11:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | if (sqrt(n)==int (sqrt(n)) | ^~ suma_divizori.cpp:11:11: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 11 | if (sqrt(n)==int (sqrt(n)) | ^~~~ suma_divizori.cpp:11:33: error: expected ‘;’ before ‘s’ 11 | if (sqrt(n)==int (sqrt(n)) | ^ | ; 12 | s=s+sqrt(n); | ~ suma_divizori.cpp:11:18: warning: value computed is not used [-Wunused-value] 11 | if (sqrt(n)==int (sqrt(n)) | ~~~~~~~^~~~~~~~~~~~~~~ suma_divizori.cpp:13:18: error: expected ‘)’ before ‘;’ token 13 | cout<<s; | ^ | ) suma_divizori.cpp:11:10: note: to match this ‘(’ 11 | if (sqrt(n)==int (sqrt(n)) | ^ suma_divizori.cpp:11:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 11 | if (sqrt(n)==int (sqrt(n)) | ^~ suma_divizori.cpp:14:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 14 | return 0;} | ^~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Suma Divizori 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ă.