#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 | #53161591 | Utilizator | |
Fișier | qtsume.cpp | Dimensiune | 448 B |
Data încărcării | 19 Octombrie 2024, 16:22 | Scor / rezultat | Eroare de compilare |
qtsume.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream cout ("qtsume.out") ^ qtsume.cpp: In function 'int main()': qtsume.cpp:9:10: error: 'n' was not declared in this scope cin>>n; ^ qtsume.cpp:10:9: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ qtsume.cpp:12:14: error: 'v' was not declared in this scope cin>>v[i]; ^ qtsume.cpp:13:9: error: 's1' was not declared in this scope s1[i]=s1[i-1]+v[i]*i; ^ qtsume.cpp:14:9: error: 's2' was not declared in this scope s2[i]=s2[i-1]+v[i]; ^ qtsume.cpp:16:10: error: 'q' was not declared in this scope cin>>q; ^ qtsume.cpp:17:9: error: 'i' was not declared in this scope for(i=1;i<=q;i++) ^ qtsume.cpp:19:13: error: 'x' was not declared in this scope cin>>x>>y; ^ qtsume.cpp:19:16: error: 'y' was not declared in this scope cin>>x>>y; ^ qtsume.cpp:20:8: error: 'cout' was not declared in this scope cout<<s1[y]-s1[x-1]-(x-1)*(s2[y]-s2[x-1]); ^ qtsume.cpp:20:14: error: 's1' was not declared in this scope cout<<s1[y]-s1[x-1]-(x-1)*(s2[y]-s2[x-1]); ^ qtsume.cpp:20:35: error: 's2' was not declared in this scope cout<<s1[y]-s1[x-1]-(x-1)*(s2[y]-s2[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ă.