#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 | #53686519 | Utilizator | |
Fișier | plusminus.cpp | Dimensiune | 642 B |
Data încărcării | 08 Noiembrie 2024, 12:43 | Scor / rezultat | Eroare de compilare |
plusminus.cpp: In function 'void afisare()': plusminus.cpp:9:24: error: reference to 'cout' is ambiguous if(x[i] == -1) cout << "- "; ^ plusminus.cpp:4: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:10:14: error: reference to 'cout' is ambiguous else cout << "+ "; ^ plusminus.cpp:4: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:11:5: error: reference to 'cout' is ambiguous cout << '\n'; ^ plusminus.cpp:4: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:30:5: error: reference to 'cin' is ambiguous cin >> n; ^ plusminus.cpp:3: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:32:13: error: reference to 'cout' is ambiguous if(!ok) cout << "IMPOSIBIL"; ^ plusminus.cpp:4: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ă.