#1357
plusminus
Fie n
un număr natural.
Să se determine toate posibilitățile de alegere a semnelor +
și -
pentru care
n = (+|-) 1
2
+ (+|-) 2
2
+ ... + (+|-) n
2
Problema | plusminus | Operații I/O |
plusminus.in /plusminus.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 2 MB
/
Stivă 2 MB
|
Id soluție | #43946370 | Utilizator | |
Fișier | plusminus.cpp | Dimensiune | 652 B |
Data încărcării | 30 Mai 2023, 14:19 | Scor / rezultat | Eroare de compilare |
plusminus.cpp: In function 'void afisare()': plusminus.cpp:12:24: error: reference to 'cout' is ambiguous if(x[i] == -1) cout << "- "; ^ plusminus.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("plusminus.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from plusminus.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ plusminus.cpp:13:14: error: reference to 'cout' is ambiguous else cout << "+ "; ^ plusminus.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("plusminus.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from plusminus.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ plusminus.cpp:14:5: error: reference to 'cout' is ambiguous cout << '\n'; ^ plusminus.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("plusminus.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from plusminus.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ plusminus.cpp: In function 'int main()': plusminus.cpp:35:5: error: reference to 'cin' is ambiguous cin >> n; ^ plusminus.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("plusminus.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from plusminus.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ plusminus.cpp:37:13: error: reference to 'cout' is ambiguous if(!ok) cout << "IMPOSIBIL"; ^ plusminus.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("plusminus.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from plusminus.cpp:1: /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 plusminus 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ă.