#1236
Manole este extrem de răcit. Din această cauză a mers la medicul de familie care l-a sfătuit urmeze un tratament cu N pastile, din care trebuie să ia în fiecare zi câte o jumătate. A cumpărat de la farmacie o cutie în care se aflau exact N pastile, fiecare dintre ele având pe suprafață o dungă care marchează jumătatea ei.
Manole începe să își ia tratamentul și constată că poate proceda doar astfel:
Scrieți un program care determină numărul de posibilități în care poate lua toate cele N pastile, procedând după procedeul descris mai sus.
Lot Juniori, Valcea, 2015
| Problema | Pastile | Operații I/O |
pastile.in/pastile.out
|
|---|---|---|---|
| Limita timp | 0.4 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
| Id soluție | #64598571 | Utilizator | |
| Fișier | pastile.cpp | Dimensiune | 16.08 KB |
| Data încărcării | 17 Mai 2026, 23:01 | Scor/rezultat | 60 puncte |
pastile.cpp: In member function ‘std::string NrMari::to_string() const’: pastile.cpp:454:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 454 | for(int i=0;i<s.size()/2;i++) | ~^~~~~~~~~~~ pastile.cpp: In member function ‘NrMari& NrMari::operator*=(const NrMari&)’: pastile.cpp:705:37: warning: unused variable ‘j’ [-Wunused-variable] 705 | __int128 carry=0,borrow=0,i,j=0; | ^ pastile.cpp: In instantiation of ‘varray<T>::varray(int) [with T = long long int]’: pastile.cpp:345:15: required from here pastile.cpp:12:9: warning: ‘varray<long long int>::sz’ will be initialized after [-Wreorder] 12 | int sz=0; | ^~ pastile.cpp:11:8: warning: ‘long long int* varray<long long int>::_elem’ [-Wreorder] 11 | T* _elem; | ^~~~~ pastile.cpp:57:5: warning: when initialized here [-Wreorder] 57 | varray(int _sz=0): sz(_sz), _elem(nullptr), sz_max(_sz) | ^~~~~~ pastile.cpp: In instantiation of ‘varray<T>::varray(const varray<T>&) [with T = long long int]’: pastile.cpp:395:34: required from here pastile.cpp:12:9: warning: ‘varray<long long int>::sz’ will be initialized after [-Wreorder] 12 | int sz=0; | ^~ pastile.cpp:11:8: warning: ‘long long int* varray<long long int>::_elem’ [-Wreorder] 11 | T* _elem; | ^~~~~ pastile.cpp:64:5: warning: when initialized here [-Wreorder] 64 | varray(const varray& other): sz(other.size()), _elem(new T[other.size()]), sz_max(other.size()) | ^~~~~~ pastile.cpp: In instantiation of ‘varray<T>::varray(int) [with T = __int128]’: pastile.cpp:641:42: required from here pastile.cpp:12:9: warning: ‘varray<__int128>::sz’ will be initialized after [-Wreorder] 12 | int sz=0; | ^~ pastile.cpp:11:8: warning: ‘__int128* varray<__int128>::_elem’ [-Wreorder] 11 | T* _elem; | ^~~~~ pastile.cpp:57:5: warning: when initialized here [-Wreorder] 57 | varray(int _sz=0): sz(_sz), _elem(nullptr), sz_max(_sz) | ^~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.001 secunde | OK. | 5 | 5 | ||
| 1 | 0.001 secunde | OK. | 5 | 5 | ||
| 2 | 0.001 secunde | OK. | 5 | 5 | ||
| 3 | 0.001 secunde | OK. | 5 | 5 | ||
| 4 | 0.006 secunde | OK. | 5 | 5 | ||
| 5 | 0.023 secunde | OK. | 5 | 5 | ||
| 6 | 0.052 secunde | OK. | 5 | 5 | ||
| 7 | 0.095 secunde | OK. | 5 | 5 | ||
| 8 | 0.146 secunde | OK. | 5 | 5 | ||
| 9 | 0.219 secunde | OK. | 5 | 5 | ||
| 10 | 0.171 secunde | OK. | 5 | 5 | ||
| 11 | 0.337 secunde | OK. | 5 | 5 | ||
| 12 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 13 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 14 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 15 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 16 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 17 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 18 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 19 | Depășit | Limita de timp depășită | 5 | 0 | ||
| Punctaj total | 60 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Pastile 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ă.