[Description]: This is a blog of others. It has a clear description of the question and a solution. It can be used to solve this problem!
[Analysis]: greedy? Simulation? See the code
// 216 K 16 Ms # include <iostream> using namespace STD; int main () {int ans, A, B, C, D, E, F, two, one; // two indicates the number of 2*2, and one indicates the number of 1*1. Int U [4] = {0, 5, 3, 1}; while (1) {CIN> A> B> C> D> E> F; if (A = 0 & B = 0 & C = 0 & D = 0 & E = 0 & F = 0) break; ans = F + E + D + (C + 3)/4; // here (C + 3)/4 is equal to C divided by 4 and rounded up. Of course, we can also replace it with the ceiling Function two = 5 * D + U [C % 4]; If (B> Two) ans + = (B-two + 8) /9; // The method here is the same as (C + 3)/4, which is rounded up; one = 36 * ANS-36 * F-25 * E-16 * D-9 * C-4 * B; // The number of packages currently in use can be filled with 1*1! If (A> one) ans + = (A-one + 35)/36; // The same method is used. Cout <ans <Endl;} return 0 ;}
Poj 1017 packets (accumulation)