#4616
Robotron
În sistemul solar Stelarion sunt 99
de planete. Planeta Hazard găzduiește campionatul de Robotron pe echipe. Jucătorii sunt înregistrați în ordinea sosirii lor, indiferent de planeta de pe care provin. Anul acesta s-au înscris în campionat N
jucători de pe M
planete. Jucătorul înregistrat al i
-lea (cu i
de la 1
la N
) primește două numere: E[i]
— numărul trecut pe ecuson și P[i]
— puterea jucătorului. Numărul trecut pe ecuson este format din codul planetei jucătorului CP
(numărul format din ultimele două cifre de pe ecuson) și codul jucătorului CJ
(numărul format din restul cifrelor).
1) Să se determine numărul M
al echipelor participante și codul H
al planetei gazdă Hazard, știind că numărul jucătorilor din echipa planetei gazdă este strict mai mare decât numărul jucătorilor oricărei alte echipe.
2) Să se determine codul planetei de pe care provine echipa câștigătoare la runda K
și codul jucătorului care aduce victoria acestei echipei la aceasta rundă.
OJI 2024, clasa a 8-a
Problema | Robotron | Operații I/O |
robotron.in /robotron.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 256 MB
/
Stivă 8 MB
|
Id soluție | #54863616 | Utilizator | |
Fișier | robotron.cpp | Dimensiune | 1.47 KB |
Data încărcării | 10 Decembrie 2024, 18:08 | Scor / rezultat | Eroare de compilare |
robotron.cpp: In function 'int main()': robotron.cpp:51:13: error: ambiguous overload for 'operator>>' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') if(f>>a[i][1]%100==f>>a[i-x][1]%100) ^ robotron.cpp:51:13: note: candidates are: In file included from /usr/include/c++/4.8/iostream:40:0, from robotron.cpp:1: /usr/include/c++/4.8/istream:120:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(__istream_type& (*__pf)(__istream_type&)) ^ /usr/include/c++/4.8/istream:120:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}' /usr/include/c++/4.8/istream:124:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator>>(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/4.8/istream:124:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' /usr/include/c++/4.8/istream:131:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(ios_base& (*__pf)(ios_base&)) ^ /usr/include/c++/4.8/istream:131:7: note: no known conversion for argument 1 from 'int' to 'std::ios_base& (*)(std::ios_base&)' /usr/include/c++/4.8/istream:259:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match> operator>>(__streambuf_type* __sb); ^ /usr/include/c++/4.8/istream:259:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}' robotron.cpp:51:29: error: ambiguous overload for 'operator>>' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') if(f>>a[i][1]%100==f>>a[i-x][1]%100) ^ robotron.cpp:51:29: note: candidates are: In file included from /usr/include/c++/4.8/iostream:40:0, from robotron.cpp:1: /usr/include/c++/4.8/istream:120:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(__istream_type& (*__pf)(__istream_type&)) ^ /usr/include/c++/4.8/istream:120:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}' /usr/include/c++/4.8/istream:124:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator>>(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/4.8/istream:124:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' /usr/include/c++/4.8/istream:131:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(ios_base& (*__pf)(ios_base&)) ^ /usr/include/c++/4.8/istream:131:7: note: no known conversion for argument 1 from 'int' to 'std::ios_base& (*)(std::ios_base&)' /usr/include/c++/4.8/istream:259:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match> operator>>(__streambuf_type* __sb); ^ /usr/include/c++/4.8/istream:259:7: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}' robotron.cpp:53:20: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' f>>a[uc] ^ In file included from /usr/include/c++/4.8/iostream:40:0, from robotron.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [5]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ robotron.cpp:54:9: error: expected ';' before '}' token } ^ robotron.cpp:70:15: error: expected primary-expression before ')' token while() ^ robotron.cpp:72:9: error: 's' was not declared in this scope s=s+c[m]; ^ robotron.cpp:73:9: error: 'ct' was not declared in this scope ct++; ^ robotron.cpp:75:9: error: expected primary-expression before '}' token } ^ robotron.cpp:75:9: error: expected ';' before '}' token
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Robotron 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ă.