#1212
Să se calculeze suma S=12 + 22 + 32 + ... + n2, modulo 10.234.573.
| Problema | SumaPătrate | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64492163 | Utilizator | |
| Fișier | sumapătrate.cpp | Dimensiune | 383 B |
| Data încărcării | 11 Mai 2026, 08:53 | Scor/rezultat | Eroare de compilare |
sumapătrate.cpp: In function ‘int main()’: sumapătrate.cpp:5:1: error: ‘cin’ was not declared in this scope 5 | cin>>n; | ^~~ sumapătrate.cpp:15:16: error: expected ‘)’ before ‘;’ token 15 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n+1;) | ~ ^ | ) sumapătrate.cpp:15:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 15 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n+1;) | ^~ sumapătrate.cpp:15:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 15 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n+1;) | ^ sumapătrate.cpp:15:37: error: expected primary-expression before ‘)’ token 15 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n+1;) | ^ sumapătrate.cpp:29:10: error: expected ‘}’ at end of input 29 | return 0: | ^ sumapătrate.cpp:11:9: note: to match this ‘{’ 11 | if(r==1){ a=n; b=(n+1)/2; c=(2*n+1)/3; | ^ sumapătrate.cpp:29:10: error: expected ‘}’ at end of input 29 | return 0: | ^ sumapătrate.cpp:9:9: note: to match this ‘{’ 9 | if(r==0){ a=n/6; b=n+1; c=2*n+1; | ^ sumapătrate.cpp:29:10: error: expected ‘}’ at end of input 29 | return 0: | ^ sumapătrate.cpp:1:15: note: to match this ‘{’ 1 | int main(void){ | ^ sumapătrate.cpp:3:21: warning: unused variable ‘m’ [-Wunused-variable] 3 | long long n,a,b,c,r,m=10234573; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumaPătrate 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ă.