#3644
joc12
Ioana și Maria tocmai au învățat la matematică despre multiplii unui număr natural. Pentru a exersa lucrul cu noua noțiune, își propun să joace următorul joc: fiecare își alege câte un număr natural nenul și pentru câte un interval închis dat (la intervalele închise capetele fac parte din interval), calculează câți multipli are numărul ales în acel interval. Câștigă cea care a ales numărul care are mai mulți multipli în intervalul primit, sau este egalitate în cazul în care numărul multiplilor este acelaşi. Cunoscând numerele alese de cele două fete precum și numerele care determină intervalele date, să se determine cine câștigă jocul și care este numărul care conduce la câștigarea jocului.
Concursul Național Info Pro, Etapa I
Problema | joc12 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53430668 | Utilizator | |
Fișier | joc12.cpp | Dimensiune | 310 B |
Data încărcării | 30 Octombrie 2024, 10:43 | Scor / rezultat | Eroare de compilare |
joc12.cpp: In function 'int main()': joc12.cpp:13:15: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' and 'long int') cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ joc12.cpp:13:15: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 joc12.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:233:5: note: template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:233:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::pair<_T1, _T2>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ 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 joc12.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:309:5: note: template<class _Iterator> bool 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:309:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ 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 joc12.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:359:5: note: template<class _IteratorL, class _IteratorR> bool 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:359:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ 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 joc12.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1079:5: note: template<class _IteratorL, class _IteratorR> bool 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:1079:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::move_iterator<_Iterator>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ 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 joc12.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1085:5: note: template<class _Iterator> bool 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:1085:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::move_iterator<_Iterator>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from joc12.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2606:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2606:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from joc12.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2618:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2618:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from joc12.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2630:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator>(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2630:5: note: template argument deduction/substitution failed: joc12.cpp:13:17: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ joc12.cpp:13:64: error: invalid operands of types 'const char [10]' and 'const char [2]' to binary 'operator<<' cout << i > m ? "Ioana" : m > i ? "Maria" : "Egalitate" << " " << max(i,m); ^ joc12.cpp:6:26: warning: unused variable 'temp' [-Wunused-variable] long x,a,b,y,c,d,i,m,temp; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema joc12 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ă.