#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 | #64492139 | Utilizator | |
| Fișier | sumapătrate.cpp | Dimensiune | 367 B |
| Data încărcării | 11 Mai 2026, 08:52 | Scor/rezultat | Eroare de compilare |
sumapătrate.cpp: In function ‘int main()’: sumapătrate.cpp:8:24: error: expected ‘)’ before ‘;’ token 8 | if(r==0)( a=n/6; b=n+1; c=2*n=1;) | ~ ^ | ) sumapătrate.cpp:8:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 8 | if(r==0)( a=n/6; b=n+1; c=2*n=1;) | ^~ sumapătrate.cpp:8:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 8 | if(r==0)( a=n/6; b=n+1; c=2*n=1;) | ^ sumapătrate.cpp:8:36: error: lvalue required as left operand of assignment 8 | if(r==0)( a=n/6; b=n+1; c=2*n=1;) | ~^~ sumapătrate.cpp:8:41: error: expected primary-expression before ‘)’ token 8 | if(r==0)( a=n/6; b=n+1; c=2*n=1;) | ^ sumapătrate.cpp:9:47: error: expected primary-expression before ‘)’ token 9 | if(r==1)( a=n; b=(n+1)/2; c=(2*n+1)/3;) | ^ sumapătrate.cpp:10:47: error: expected ‘)’ before ‘;’ token 10 | if(r==2)( a=n/2; b=(n+1)/3; c=(2*n+1/3;) | ~ ^ | ) sumapătrate.cpp:10:48: error: expected primary-expression before ‘)’ token 10 | if(r==2)( a=n/2; b=(n+1)/3; c=(2*n+1/3;) | ^ sumapătrate.cpp:11:40: error: lvalue required as left operand of assignment 11 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n=1;) | ~^~ sumapătrate.cpp:11:45: error: expected primary-expression before ‘)’ token 11 | if(r==3)( a=n/3; b=(n+1)/2; c=2*n=1;) | ^ sumapătrate.cpp:12:45: error: expected primary-expression before ‘)’ token 12 | if(r==4)( a=n/2; b=n+1; c=(2*n+1)/3;) | ^ sumapătrate.cpp:13:43: error: expected primary-expression before ‘)’ token 13 | if(r==5)( a=n; b=(n+1)/6; c=2*n+1;) | ^ sumapătrate.cpp:5:29: warning: unused variable ‘m’ [-Wunused-variable] 5 | 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ă.