#3796
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 | #57380512 | Utilizator | |
Fișier | qtsume.cpp | Dimensiune | 604 B |
Data încărcării | 28 Martie 2025, 09:41 | Scor / rezultat | Eroare de compilare |
qtsume.cpp:4:15: error: 'qtsume' was not declared in this scope ifstream fin (qtsume.in); ^ qtsume.cpp:5:16: error: 'qtsume' was not declared in this scope ofstream fout (qtsume.out); ^ qtsume.cpp: In function 'int main()': qtsume.cpp:13:11: error: 'a' was not declared in this scope s1[1]=a[1]; ^ qtsume.cpp:14:22: error: 'n' was not declared in this scope for (int i=2; i<=n; i++) ^ qtsume.cpp:17:22: error: 'n' was not declared in this scope for (int i=2; i<=n; i++) ^ qtsume.cpp:19:10: error: 'q' was not declared in this scope fin>>q; ^ qtsume.cpp:24:38: error: 's' was not declared in this scope fout<<(s2[y]-s2[x-1])-(x-1)*(s[y]-s[x-1])<<"\n"; ^ qtsume.cpp:9:23: warning: unused variable 'Q' [-Wunused-variable] int N, A[100000], Q, x, y; ^
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ă.