#1936
Catalin si codul secret
În banca lui Cătălin există un seif special unde Moș Crăciun își ține ascunse cadourile pentru copiii cei cuminți. Fiind vorba de o persoană așa de importantă, codul seifului nu este unul ușor. Moșului îi este dat un cartonaș cu n
numere pe care le parcurge, în ordine, de la al doilea la penultimul, şi verifică pentru fiecare număr dacă cei 2
vecini sunt ori divizori ori multipli ai acestuia. Dacă da, va șterge primul triplet care respectă această regulă (numărul şi vecinii săi), formându-se un nou cod pentru care se reia de la început aplicarea regulii, până când nu mai există pe cartonaș niciun număr care să respecte proprietatea de eliminat.
La final se vor obține valorile corecte ale codului, care vor fi introduse în ordinea apariției lor sau, în cazul în care s-au șters toate numerele de pe cartonaș, atunci codul va fi mesajul preferat folosit de Moș Crăciun: Merry Christmas
.
Date fiind cele n
numere de pe cartonaş, Moșul vă roagă să aflați codul de care are nevoie pentru a putea deschide seiful în seara de ajun.
Problema | Catalin si codul secret | Operații I/O |
codsecret.in /codsecret.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 6 MB
/
Stivă 3 MB
|
Id soluție | #51132482 | Utilizator | |
Fișier | catalin_si_codul_secret.cpp | Dimensiune | 768 B |
Data încărcării | 26 Mai 2024, 10:35 | Scor / rezultat | Eroare de compilare |
catalin_si_codul_secret.cpp:5:43: error: use of deleted function 'std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)' ifstream cin = ifstream("codsecret.in.txt"); ^ In file included from catalin_si_codul_secret.cpp:1:0: /usr/include/c++/4.8/fstream:427:11: note: 'std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: error: use of deleted function 'std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)' In file included from /usr/include/c++/4.8/fstream:38:0, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/istream:58:11: note: 'std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_istream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/istream:58:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' In file included from /usr/include/c++/4.8/ios:44:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/bits/basic_ios.h:66:11: note: 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_ios : public ios_base ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:792:5: error: 'std::ios_base::ios_base(const std::ios_base&)' is private ios_base(const ios_base&); ^ In file included from /usr/include/c++/4.8/ios:44:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/bits/basic_ios.h:66:11: error: within this context class basic_ios : public ios_base ^ In file included from catalin_si_codul_secret.cpp:1:0: /usr/include/c++/4.8/fstream:427:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: error: use of deleted function 'std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)' /usr/include/c++/4.8/fstream:72:11: note: 'std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_filebuf : public basic_streambuf<_CharT, _Traits> ^ In file included from /usr/include/c++/4.8/ios:43:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/streambuf:802:7: error: 'std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]' is private basic_streambuf(const basic_streambuf& __sb) ^ In file included from catalin_si_codul_secret.cpp:1:0: /usr/include/c++/4.8/fstream:72:11: error: within this context class basic_filebuf : public basic_streambuf<_CharT, _Traits> ^ catalin_si_codul_secret.cpp:6:41: error: use of deleted function 'std::basic_ofstream<char>::basic_ofstream(const std::basic_ofstream<char>&)' ofstream cout = ofstream("codsecret.txt"); ^ In file included from catalin_si_codul_secret.cpp:1:0: /usr/include/c++/4.8/fstream:599:11: note: 'std::basic_ofstream<char>::basic_ofstream(const std::basic_ofstream<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_ofstream : public basic_ostream<_CharT,_Traits> ^ /usr/include/c++/4.8/fstream:599:11: error: use of deleted function 'std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)' In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from catalin_si_codul_secret.cpp:1: /usr/include/c++/4.8/ostream:58:11: note: 'std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)' is implicitly deleted because the default definition would be ill-formed: class basic_ostream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/ostream:58:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' In file included from catalin_si_codul_secret.cpp:1:0: /usr/include/c++/4.8/fstream:599:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' class basic_ofstream : public basic_ostream<_CharT,_Traits> ^ /usr/include/c++/4.8/fstream:599:11: error: use of deleted function 'std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Catalin si codul secret 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ă.