#1163
Cei m cowboys și cei n aliens s-au întâlnit în vestul sălbatic și, păstrând tradiția locului, s-au așezat în șir indian. Cum cowboys erau gazde primitoare și în special foarte precaute, s-au gândit că între doi cowboys consecutivi ar fi bine să fie cel mult un alien (din motive de securitate). De asemenea primul și ultimul din șir să fie cawboys. Dilema care s-a ivit a fost numărul de moduri în care s-ar putea așeza în șir indian ținând cont de condițiile de securitate impuse.
| Problema | CowboysAndAliens | Operații I/O |
cowboysandaliens.in/cowboysandaliens.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64676004 | Utilizator | |
| Fișier | cowboysandaliens.cpp | Dimensiune | 7.14 KB |
| Data încărcării | 22 Mai 2026, 02:52 | Scor/rezultat | 60 puncte |
cowboysandaliens.cpp: In function ‘long long unsigned int putere(int, int)’: cowboysandaliens.cpp:27:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long long unsigned int’ [-Wsign-compare] 27 | while (b > produs) { | ~~^~~~~~~~ cowboysandaliens.cpp:32:16: warning: comparison of integer expressions of different signedness: ‘long long unsigned int’ and ‘int’ [-Wsign-compare] 32 | if (produs <= b) { | ~~~~~~~^~~~ cowboysandaliens.cpp: In function ‘int PB_ceva()’: cowboysandaliens.cpp:124:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 124 | for (int i = 0; i < strlen(n); i++) { | ~~^~~~~~~~~~~ cowboysandaliens.cpp:125:13: warning: array subscript has type ‘char’ [-Wchar-subscripts] 125 | freq[n[i]]++; | ~~~^ cowboysandaliens.cpp:128:14: warning: array subscript has type ‘char’ [-Wchar-subscripts] 128 | if (freq[i] > 1) { | ^ cowboysandaliens.cpp:129:37: warning: array subscript has type ‘char’ [-Wchar-subscripts] 129 | suma /= Permutari_cu_mod(freq[i]); | ^ cowboysandaliens.cpp:121:7: warning: unused variable ‘k’ [-Wunused-variable] 121 | int k; | ^ cowboysandaliens.cpp: In function ‘int descompunere_factori_factoriale()’: cowboysandaliens.cpp:141:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long long unsigned int’ [-Wsign-compare] 141 | for (int i = max(b, c) + 1; i <= a; i++) { | ~~^~~~ cowboysandaliens.cpp:152:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const long long unsigned int’ [-Wsign-compare] 152 | for (int i = 2; i <= min(b, c); i++) { | ~~^~~~~~~~~~~~ cowboysandaliens.cpp:165:1: warning: no return statement in function returning non-void [-Wreturn-type] 165 | } | ^ cowboysandaliens.cpp: In function ‘int ma2in()’: cowboysandaliens.cpp:172:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long long unsigned int’ [-Wsign-compare] 172 | for (int i = max(b, c) + 1; i <= a; i++) { | ~~^~~~ cowboysandaliens.cpp:179:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const long long unsigned int’ [-Wsign-compare] 179 | for (int i = 2; i <= min(b, c); i++) { | ~~^~~~~~~~~~~~ cowboysandaliens.cpp:169:27: warning: unused variable ‘cntc’ [-Wunused-variable] 169 | int cnta = 0, cntb = 0, cntc = 0; | ^~~~ cowboysandaliens.cpp:192:1: warning: no return statement in function returning non-void [-Wreturn-type] 192 | } | ^ cowboysandaliens.cpp: In function ‘int pb_3630_30_limita_de_timp_depasita()’: cowboysandaliens.cpp:234:27: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘long long unsigned int’ [-Wsign-compare] 234 | for (long long i = 1; i <= n; i++) { | ~~^~~~ cowboysandaliens.cpp:241:1: warning: no return statement in function returning non-void [-Wreturn-type] 241 | } | ^ cowboysandaliens.cpp: In function ‘int pb_1297()’: cowboysandaliens.cpp:258:1: warning: no return statement in function returning non-void [-Wreturn-type] 258 | } | ^ cowboysandaliens.cpp: In function ‘int veverita_programare_dinamica()’: cowboysandaliens.cpp:289:1: warning: no return statement in function returning non-void [-Wreturn-type] 289 | } | ^ cowboysandaliens.cpp: In function ‘int pb_3589()’: cowboysandaliens.cpp:319:1: warning: no return statement in function returning non-void [-Wreturn-type] 319 | } | ^ cowboysandaliens.cpp: In function ‘int pb_2011_50()’: cowboysandaliens.cpp:334:1: warning: no return statement in function returning non-void [-Wreturn-type] 334 | } | ^ cowboysandaliens.cpp: In function ‘int prob4812()’: cowboysandaliens.cpp:229:1: warning: control reaches end of non-void function [-Wreturn-type] 229 | } | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.002 secunde | OK. | 10 | 10 | Exemplu | |
| 2 | 0.001 secunde | OK. | 10 | 10 | ||
| 3 | 0.001 secunde | OK. | 10 | 10 | ||
| 4 | 0.001 secunde | OK. | 10 | 10 | ||
| 5 | 0.001 secunde | OK. | 10 | 10 | ||
| 6 | 0.003 secunde | OK. | 10 | 10 | ||
| 7 | 0.003 secunde | Caught fatal signal 11 | 10 | 0 | ||
| 8 | 0.004 secunde | Caught fatal signal 11 | 10 | 0 | ||
| 9 | 0.002 secunde | Caught fatal signal 11 | 10 | 0 | ||
| 10 | 0.002 secunde | Caught fatal signal 11 | 10 | 0 | ||
| Punctaj total | 60 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CowboysAndAliens 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ă.