#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 | #64621201 | Utilizator | |
| Fișier | pastile.cpp | Dimensiune | 17.96 KB |
| Data încărcării | 19 Mai 2026, 08:20 | Scor/rezultat | 75 puncte |
pastile.cpp: In member function ‘std::string NrMari::to_string() const’: pastile.cpp:488:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 488 | for(int i=0;i<s.size()/2;i++) | ~^~~~~~~~~~~ pastile.cpp: In member function ‘NrMari& NrMari::operator*=(const NrMari&)’: pastile.cpp:739:37: warning: unused variable ‘j’ [-Wunused-variable] 739 | __int128 carry=0,borrow=0,i,j=0; | ^ pastile.cpp: In function ‘int main()’: pastile.cpp:864:11: warning: unused variable ‘m’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^ pastile.cpp:864:17: warning: unused variable ‘k’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^ pastile.cpp:864:19: warning: unused variable ‘t’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^ pastile.cpp:864:21: warning: unused variable ‘q’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^ pastile.cpp:864:26: warning: unused variable ‘minim’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^~~~~ pastile.cpp:864:32: warning: unused variable ‘maxim’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^~~~~ pastile.cpp:864:38: warning: unused variable ‘suma’ [-Wunused-variable] 864 | int n,m,i,j,k,t,q,nr,minim,maxim,suma; | ^~~~ pastile.cpp: In instantiation of ‘varray<T>::varray(int) [with T = long long int]’: pastile.cpp:379:15: required from here pastile.cpp:13:9: warning: ‘varray<long long int>::sz’ will be initialized after [-Wreorder] 13 | int sz=0; | ^~ pastile.cpp:12:8: warning: ‘long long int* varray<long long int>::_elem’ [-Wreorder] 12 | T* _elem; | ^~~~~ pastile.cpp:58:5: warning: when initialized here [-Wreorder] 58 | 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:429:34: required from here pastile.cpp:13:9: warning: ‘varray<long long int>::sz’ will be initialized after [-Wreorder] 13 | int sz=0; | ^~ pastile.cpp:12:8: warning: ‘long long int* varray<long long int>::_elem’ [-Wreorder] 12 | T* _elem; | ^~~~~ pastile.cpp:65:5: warning: when initialized here [-Wreorder] 65 | 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:675:42: required from here pastile.cpp:13:9: warning: ‘varray<__int128>::sz’ will be initialized after [-Wreorder] 13 | int sz=0; | ^~ pastile.cpp:12:8: warning: ‘__int128* varray<__int128>::_elem’ [-Wreorder] 12 | T* _elem; | ^~~~~ pastile.cpp:58:5: warning: when initialized here [-Wreorder] 58 | varray(int _sz=0): sz(_sz), _elem(nullptr), sz_max(_sz) | ^~~~~~ pastile.cpp: In instantiation of ‘varray<T>::varray(int) [with T = int]’: pastile.cpp:857:13: required from here pastile.cpp:13:9: warning: ‘varray<int>::sz’ will be initialized after [-Wreorder] 13 | int sz=0; | ^~ pastile.cpp:12:8: warning: ‘int* varray<int>::_elem’ [-Wreorder] 12 | T* _elem; | ^~~~~ pastile.cpp:58:5: warning: when initialized here [-Wreorder] 58 | varray(int _sz=0): sz(_sz), _elem(nullptr), sz_max(_sz) | ^~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.002 secunde | OK. | 5 | 5 | ||
| 1 | 0.001 secunde | OK. | 5 | 5 | ||
| 2 | 0.002 secunde | OK. | 5 | 5 | ||
| 3 | 0.001 secunde | OK. | 5 | 5 | ||
| 4 | 0.002 secunde | OK. | 5 | 5 | ||
| 5 | 0.002 secunde | OK. | 5 | 5 | ||
| 6 | 0.003 secunde | OK. | 5 | 5 | ||
| 7 | 0.003 secunde | OK. | 5 | 5 | ||
| 8 | 0.004 secunde | OK. | 5 | 5 | ||
| 9 | 0.005 secunde | OK. | 5 | 5 | ||
| 10 | 0.004 secunde | OK. | 5 | 5 | ||
| 11 | 0.006 secunde | OK. | 5 | 5 | ||
| 12 | 0.008 secunde | OK. | 5 | 5 | ||
| 13 | 0.009 secunde | OK. | 5 | 5 | ||
| 14 | 0.028 secunde | OK. | 5 | 5 | ||
| 15 | 0.003 secunde | Caught fatal signal 8 | 5 | 0 | ||
| 16 | 0.004 secunde | Caught fatal signal 8 | 5 | 0 | ||
| 17 | 0.004 secunde | Caught fatal signal 8 | 5 | 0 | ||
| 18 | 0.004 secunde | Caught fatal signal 8 | 5 | 0 | ||
| 19 | 0.004 secunde | Caught fatal signal 8 | 5 | 0 | ||
| Punctaj total | 75 | |||||
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ă.