#2201
Salut
Într-un grup sunt N
prieteni. Când se întâlnesc se salută, fiecare dând mână cu toți ceilalți. Câte strângeri de mână au loc?
Problema | Salut | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51893762 | Utilizator | |
Fișier | salut.cpp | Dimensiune | 117 B |
Data încărcării | 04 Septembrie 2024, 18:37 | Scor / rezultat | Eroare de compilare |
salut.cpp:4:8: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] main () ^ salut.cpp: In function 'int main()': salut.cpp:7:12: error: no match for 'operator-' (operand type is 'std::ostream {aka std::basic_ostream<char>}') cin>>n;- ^ salut.cpp:7:12: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from salut.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator-(const reverse_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template argument deduction/substitution failed: salut.cpp:8:5: note: 'std::ostream {aka std::basic_ostream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' cout<<((n-1)*n)/2; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from salut.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator-(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template argument deduction/substitution failed: salut.cpp:8:5: note: 'std::ostream {aka std::basic_ostream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' cout<<((n-1)*n)/2; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from salut.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&) operator-(const move_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template argument deduction/substitution failed: salut.cpp:8:5: note: 'std::ostream {aka std::basic_ostream<char>}' is not derived from 'const std::move_iterator<_Iterator>' cout<<((n-1)*n)/2; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from salut.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template<class _Iterator> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&) operator-(const move_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template argument deduction/substitution failed: salut.cpp:8:5: note: 'std::ostream {aka std::basic_ostream<char>}' is not derived from 'const std::move_iterator<_Iterator>' cout<<((n-1)*n)/2; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Salut 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ă.