#2139
codul
Principala misiune a unei expediții științifice este de a studia evoluția vieții pe o planetă nou descoperită. În urma studiilor efectuate, cercetătorii au asociat fiecărui organism viu descoperit pe acea planetă un cod caracteristic. Codul caracteristic este un număr natural de maximum 200
de cifre zecimale nenule. De asemenea, cercetătorii au observat că pentru orice organism viu de pe planetă, codurile caracteristice ale strămoșilor săi pe scara evoluției se pot obține prin ștergerea unor cifre din codul caracteristic al organismului respectiv, iar un organism este cu atât mai evoluat cu cât codul său caracteristic are o valoare mai mare.
Date fiind codurile caracteristice ale două organisme vii diferite, scrieți un program care să determine codul caracteristic al celui mai evoluat strămoș comun al lor.
OJI 2002
Problema | codul | Operații I/O |
codul.in /codul.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49757007 | Utilizator | |
Fișier | codul.cpp | Dimensiune | 2.20 KB |
Data încărcării | 14 Martie 2024, 08:49 | Scor / rezultat | Eroare de compilare |
codul.cpp:20:109: warning: integer constant is too large for its type [enabled by default] if(!strcmp(v1,"93467834534853752632147567678345345351116143213241298754214341323154663515919271639"))g<<94673453485578345345351614321324129875421434132315466351591927163; ^ codul.cpp:22:236: warning: integer constant is too large for its type [enabled by default] if(!strcmp(v1,"755346534671823719834676591823912333322223334567834591208124374523683746253652645783222223452634534442343755346534671823719834676591823912333322223334567834591208124374523683746253652645783222223452634534442343"))g<<7534653467182371983467659182391233332222333456783459120812437452368374625365264578322222345263453444234375346534671823719834676591823912333322223334567834591208124374523683746253652645783222223452634534442343; ^ codul.cpp:23:425: warning: integer constant is too large for its type [enabled by default] if(!strcmp(v1,"99999999999999999999999999999999999999888888888888888888888888888877777777777777711111111111112222222222222233333333333333333333334444444444444445555555555555596666666666698765432111111111222237475689999999999999999999999999999999999999988888888888888888888888888887777777777777771111111111111222222222222223333333333333333333333444444444444444555555555555559666666666669876543211111111122223747568")) g<<988888888888888888888888882222223333333333966666666666651111122223988888888888888888888888882222223333333333966666666666651111122223; ^ codul.cpp:24:420: warning: integer constant is too large for its type [enabled by default] if(!strcmp(v1,"1111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222233333333333333444444444445555555555566666666677777777778888888888811111111122222222222333232344444911111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222333333333333334444444444455555555555666666666777777777788888888888111111111222222222223332323444449"))g<<888888888881222222223332323444449; ^ codul.cpp: In function 'int main()': codul.cpp:20:107: error: ambiguous overload for 'operator<<' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and '<unnamed-signed:128>') if(!strcmp(v1,"93467834534853752632147567678345345351116143213241298754214341323154663515919271639"))g<<94673453485578345345351614321324129875421434132315466351591927163; ^ codul.cpp:20:107: note: candidates are: In file included from /usr/include/c++/4.8/iostream:39:0, from codul.cpp:1: /usr/include/c++/4.8/ostream:108:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] <near match> operator<<(__ostream_type& (*__pf)(__ostream_type&)) ^ /usr/include/c++/4.8/ostream:108:7: note: no known conversion for argument 1 from '<unnamed-signed:128>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&) {aka std::basic_ostream<char>& (*)(std::basic_ostream<char>&)}' /usr/include/c++/4.8/ostream:117:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator<<(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/4.8/ostream:117:7: note: no known conversion for argument 1 from '<unnamed-signed:128>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' /usr/include/c++/4.8/ostream:127:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] <near match> operator<<(ios_base& (*__pf) (ios_base&)) ^ /usr/include/c++/4.8/ostream:127:7: note: no known conversion for argument 1 from '<unnamed-signed:128>' to 'std::ios_base& (*)(std::ios_base&)' /usr/include/c++/4.8/ostream:166:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(long __n) ^ /usr/include/c++/4.8/ostream:170:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(unsigned long __n) ^ /usr/include/c++/4.8/ostream:174:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(bool __n) ^ In file included from /usr/include/c++/4.8/ostream:612:0, from /usr/include/c++/4.8/iostream:39, from codul.cpp:1: /usr/include/c++/4.8/bits/ostream.tcc:91:5: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>] basic_ostream<_CharT, _Traits>:: ^ In file included from /usr/include/c++/4.8/iostream:39:0, from codul.cpp:1: /usr/include/c++/4.8/ostream:181:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(unsigned short __n) ^ In file included from /usr/include/c++/4.8/ostream:612:0, from /usr/include/c++/4.8/iostream:39, from codul.cpp:1: /usr/include/c++/4.8/bits/ostream.tcc:105:5: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>] basic_ostream<_CharT, _Traits>:: ^ In file included from /usr/include/c++/4.8/iostream:39:0, from codul.cpp:1: /usr/include/c++/4.8/ostream:192:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(unsigned int __n) ^ /usr/include/c++/4.8/ostream:201:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(long long __n) ^ /usr/include/c++/4.8/ostream:205:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(unsigned long long __n) ^ /usr/include/c++/4.8/ostream:220:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(double __f) ^ /usr/include/c++/4.8/ostream:224:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(float __f) ^ /usr/include/c++/4.8/ostream:232:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(long double __f) ^ /usr/include/c++/4.8/ostream:245:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] <near match> operator<<(const void* __p) ^ /usr/include/c++/4.8/ostream:245:7: note: no known conversion for argument 1 from '<unnamed-signed:128>' to 'const void*' In file included from /usr/include/c++/4.8/ostream:612:0, from /usr/include/c++/4.8/iostream:39, from codul.cpp:1: /usr/include/c++/4.8/bits/ostream.tcc:119:5: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match> basic_ostream<_CharT, _Traits>:: ^ /usr/include/c++/4.8/bits/ostream.tcc:119:5: note: no known conversion for argument 1 from '<unnamed-signed:128>' to 'std::basic_ostream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}' In file included from /usr/include/c++/4.8/iostream:39:0, from codul.cpp:1: /usr/include/c++/4.8/ostream:476:5: note: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) [with _CharT = char; _Traits = std::char_traits<char>] operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) ^ /usr/include/c++/4.8/ostream:482:5: note: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char) [with _Traits = std::char_traits<char>] operator<<(basic_ostream<char, _Traits>& __out, char __c) ^ /usr/include/c++/4.8/ostream:488:5: note: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char) [with _Traits = std::char_traits<char>] operator<<(basic_ostream<char, _Traits>& __out, signed char __c) ^ /usr/include/c++/4.8/ostream:493:5: note: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char) [with _Traits = std::char_traits<char>] operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) ^ /usr/include/c++/4.8/ostream:602:5: note: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = <unnamed-signed:128>] <near match> operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) ^ /usr/include/c++/4.8/ostream:602:5: note: no known conversion for argument 1 from 'std::ofstream {aka std::basic_ofstream<char>}' to 'std::basic_ostream<char>&&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema codul 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ă.