#3796
qtsume
Se dă un vector A
cu N
numere naturale. Pentru Q
întrebări de forma (x, y)
aflați rezultatul sumei A[x] + 2 * A[x + 1] + ... + (y - x + 1) * A[y]
.
Problema | qtsume | Operații I/O |
![]() qtsume.in /qtsume.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51051194 | Utilizator | |
Fișier | qtsume.cpp | Dimensiune | 461 B |
Data încărcării | 21 Mai 2024, 12:36 | Scor / rezultat | Eroare de compilare |
qtsume.cpp:2:13: error: 'umsigned' does not name a type #define ULL umsigned long long ^ qtsume.cpp:9:1: note: in expansion of macro 'ULL' ULL s[M], s1[M],n,q,x,y; ^ qtsume.cpp: In function 'int main()': qtsume.cpp:13:10: error: 'n' was not declared in this scope cin>>n; ^ qtsume.cpp:14:9: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ qtsume.cpp:16:14: error: 'x' was not declared in this scope cin>>x; ^ qtsume.cpp:17:9: error: 's' was not declared in this scope s[i]=s[i-1]+x; ^ qtsume.cpp:18:9: error: 's1' was not declared in this scope s1[i]=s1[i-1]+i*x; ^ qtsume.cpp:20:10: error: 'q' was not declared in this scope cin>>q; ^ qtsume.cpp:21:9: error: 'i' was not declared in this scope for(i=1;i<=q;i++) ^ qtsume.cpp:23:14: error: 'x' was not declared in this scope cin>>x>>y; ^ qtsume.cpp:23:17: error: 'y' was not declared in this scope cin>>x>>y; ^ qtsume.cpp:24:15: error: 's1' was not declared in this scope cout<<s1[y]-s1[x-1]-(x-1)*(s[x]-s[x-1])<<" "; ^ qtsume.cpp:24:36: error: 's' was not declared in this scope cout<<s1[y]-s1[x-1]-(x-1)*(s[x]-s[x-1])<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema qtsume 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ă.