#1933
Fie N un numar natural și un șir de N numere naturale V[1], V[2], …, V[N]. Pentru M întrebări de forma (i,j), să se calculeze suma termenilor V[i], V[i + 1], …, V[j].
Moisil++, 2016
| Problema | Sume2 | Operații I/O |
sume2.in/sume2.out
|
|---|---|---|---|
| Limita timp | 0.6 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64257809 | Utilizator | |
| Fișier | sume2.cpp | Dimensiune | 299 B |
| Data încărcării | 26 Aprilie 2026, 18:44 | Scor/rezultat | Eroare de compilare |
sume2.cpp:4:1: error: expected ‘,’ or ‘;’ before ‘ofstream’ 4 | ofstream fout("sume2.out") | ^~~~~~~~ sume2.cpp: In function ‘int main()’: sume2.cpp:8:14: error: ‘n’ was not declared in this scope 8 | fin>>n; | ^ sume2.cpp:9:13: error: ‘i’ was not declared in this scope 9 | for(i=1; i<=n; i++) | ^ sume2.cpp:11:22: error: ‘x’ was not declared in this scope 11 | fin>>x; | ^ sume2.cpp:12:17: error: ‘s’ was not declared in this scope 12 | s[i]=s[i-1]+x; | ^ sume2.cpp:14:14: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 14 | fin>>m; | ^ | tm sume2.cpp:15:13: error: ‘i’ was not declared in this scope 15 | for(i=1; i<=m; i++) | ^ sume2.cpp:16:22: error: ‘a’ was not declared in this scope 16 | { fin>>a>>b; | ^ sume2.cpp:16:25: error: ‘b’ was not declared in this scope 16 | { fin>>a>>b; | ^ sume2.cpp:17:17: error: ‘fout’ was not declared in this scope 17 | fout<<s[b]-s[a-1]<<"\n"; | ^~~~ sume2.cpp:17:23: error: ‘s’ was not declared in this scope 17 | fout<<s[b]-s[a-1]<<"\n"; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Sume2 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ă.