Woburn Challenge 2018-19 Round 4 - Junior Division
Problem 3: Inventory
Billy, the king of video games, has received exclusive early access to play the upcoming action role-playing game Diablo Immortal! He's found that it truly revolutionizes the Diablo series, not only by moving to the superior gaming environment of a mobile phone, but by introducing a new system for managing the player's item inventory.
Billy has 1 or more items which he'd like his character to carry around, each of which has a certain size which indicates how many inventory slots it takes up. There are A size-1 items (which take up 1 inventory slot each), B size-2 items, and C size-3 items (0 ≤ A, B, C ≤ 1,000,000,000, 1 ≤ A + B + C ≤ 1,000,000,000).
The character isn't allowed to carry all of these items around directly, as that would be unrealistic. Instead, they must be packed into knapsacks. Each knapsack has 3 inventory slots, meaning that it can fit 1 or more items as long as the sum of their sizes is at most 3. Each item must be packed entirely into a single knapsack.
The character may carry any number of knapsacks, but each one must be purchased through an in-game microtransaction, so Billy would prefer to use as few as possible. Help him determine the minimum number of knapsacks required to fit all of the items!
In test cases worth 16/28 of the points, A + B + C ≤ 100.
The first and only line of input consists of three space-separated integers, A, B, and C.
Output a single integer, the minimum number of knapsacks required.
Sample Input 1
1 1 1
Sample Output 1
Sample Input 2
100 0 0
Sample Output 2
In the first case, Billy can fill one knapsack with both the size-1 and the size-2 items, and a second knapsack with the size-3 item.
In the second case, Billy can fill 33 knapsacks with 3 size-1 items each, and pack the single leftover size-1 item into a 34th knapsack.
Point Value: 5 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 22, 2019
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3