#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 | #53702343 | Utilizator | |
Fișier | qtsume.cpp | Dimensiune | 640 B |
Data încărcării | 09 Noiembrie 2024, 00:01 | Scor / rezultat | Eroare de compilare |
qtsume.cpp: In function 'int main()': qtsume.cpp:16:5: error: reference to 'cin' is ambiguous cin >> n; ^ qtsume.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("qtsume.in"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qtsume.cpp:18:9: error: reference to 'cin' is ambiguous cin >> v[i]; ^ qtsume.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("qtsume.in"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qtsume.cpp:23:5: error: reference to 'cin' is ambiguous cin >> q; ^ qtsume.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("qtsume.in"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qtsume.cpp:25:9: error: reference to 'cin' is ambiguous cin >> x >> y; ^ qtsume.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("qtsume.in"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qtsume.cpp:27:13: error: reference to 'cout' is ambiguous cout << (y - x + 1) * sp[y] - (sp_2[y - 1] - sp_2[x - 2]) << "\n"; ^ qtsume.cpp:9:10: note: candidates are: std::ofstream cout ofstream cout("qtsume.out"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ qtsume.cpp:29:13: error: reference to 'cout' is ambiguous cout << (y - x + 1) * sp[y] - sp_2[y - 1] << "\n"; ^ qtsume.cpp:9:10: note: candidates are: std::ofstream cout ofstream cout("qtsume.out"); ^ In file included from qtsume.cpp:2:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
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ă.