#4655
mandms
Andra are un pachet cu n
tipuri de buline de ciocolată, cu câte c[i]
buline de fiecare tip i
. Andra dorește să utilizeze toate bulinele pentru a construi piramide, fiecare fiind formată din unul sau mai multe rânduri, numerotate începând de la 1
. Pentru fiecare piramidă în parte, pe rândul i
, se află 2
i-1
buline. Spre exemplu, pe rândul 8
al unei piramide, se află 2
7
= 128
de buline de ciocolată. Pe fiecare rând al unei piramide se află unul sau mai multe tipuri de buline, iar același tip de buline se poate folosi pe oricâte rânduri. Dintre piramidele care se pot forma, cele serioase conțin pe fiecare rând doar un tip de buline. Folosind toate bulinele, ajutați-o pe Andra să determine:
1) Numărul minim de piramide de ciocolată pe care le poate forma.
2) Numărul minim de piramide serioase de ciocolată pe care le poate forma, astfel încât toate cele obținute să fie de acest fel.
ONI 2024, clasa a 8-a
Problema | mandms | Operații I/O |
mandms.in /mandms.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54197571 | Utilizator | |
Fișier | mandms.cpp | Dimensiune | 3.04 KB |
Data încărcării | 21 Noiembrie 2024, 20:57 | Scor / rezultat | Eroare de compilare |
mandms.cpp:5:2: warning: #warning That's the baby, that's not my baby [-Wcpp] #warning That's the baby, that's not my baby ^ mandms.cpp:9:9: error: expected unqualified-id before '__int128' typedef __int128 i128; ^ mandms.cpp:10:1: error: 'i128' does not name a type i128 INF = 1; ^ mandms.cpp: In function 'int main()': mandms.cpp:22:5: error: 'INF' was not declared in this scope INF *= 2; ^ mandms.cpp:40:5: error: 'i128' was not declared in this scope i128 total = 0; ^ mandms.cpp:40:10: error: expected ';' before 'total' i128 total = 0; ^ mandms.cpp:42:7: error: 'total' was not declared in this scope total += x; ^ mandms.cpp:47:12: error: expected ';' before 'sz' i128 sz = 0, pr = 1; ^ mandms.cpp:49:9: error: 'sz' was not declared in this scope sz += pr; ^ mandms.cpp:49:15: error: 'pr' was not declared in this scope sz += pr; ^ mandms.cpp:52:17: error: 'total' was not declared in this scope answer += total / sz; ^ mandms.cpp:52:25: error: 'sz' was not declared in this scope answer += total / sz; ^ mandms.cpp:57:5: error: 'i128' was not declared in this scope i128 f[65] = {}; ^ mandms.cpp:57:10: error: expected ';' before 'f' i128 f[65] = {}; ^ mandms.cpp:66:9: error: 'f' was not declared in this scope f[bt]++; ^ mandms.cpp:77:19: error: 'f' was not declared in this scope answer += f[lvl]; ^ mandms.cpp: In lambda function: mandms.cpp:82:14: error: expected ';' before 'have' i128 have = 0; ^ mandms.cpp:87:11: error: 'have' was not declared in this scope have += f[i]; ^ mandms.cpp:87:19: error: 'f' was not declared in this scope have += f[i]; ^ mandms.cpp: In lambda function: mandms.cpp:99:18: error: 'f' was not declared in this scope while (f[i] < make) { ^ mandms.cpp:100:18: error: expected ';' before 'pr' i128 pr = 1; ^ mandms.cpp:102:15: error: 'pr' was not declared in this scope pr *= 2; ^ mandms.cpp:104:22: error: expected ';' before 'take' i128 take = std::min(f[j], (make - f[i] + pr - 1) / pr); ^ mandms.cpp:105:25: error: 'take' was not declared in this scope f[j] -= take; ^ In file included from /usr/include/c++/4.8/cassert:43:0, from mandms.cpp:4: mandms.cpp:118:18: error: 'f' was not declared in this scope assert(f[i] >= make); ^ mandms.cpp: In function 'int main()': mandms.cpp:137:7: error: 'f' was not declared in this scope f[lvl - 1] += 2 * f[lvl]; ^ mandms.cpp:26:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("mandms.in", "r", stdin); ^ mandms.cpp:27:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("mandms.out", "w", stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema mandms 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ă.