Buy sticks
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 652 accepted submission (s): 280
Problem descriptionimyourgod need 3 kinds of sticks which have different sizes: 20 cm, 28 cm and 32 cm. however the shop only has 75-centimeter-long sticks. so he have to cut off the long stick. how many sticks he must buy at least.
Inputthe first line of input contains a number T, which means there are t cases of the test data.
There will be several test cases in the problem, each in one line. each test cases are described by 3 Non-negtive-integers separated by one space representing the number of sticks of 20 cm, 28 cm and 32 cm. all numbers are less than 10 ^ 6.
Outputthe output contains one line for each line in the input case. This line contains the minimal number of 75-centimeter-long sticks he must buy. format are shown as sample output.
Sample input2 3 1 1 4 2 2
Sample outputcase 1: 2 Case 2: 3
Authorimyourgod (Special thanks: crackerwang & louty)
Source2010 ACM-ICPC multi-university training Contest (14) -- host by bjtu
Recommendzhouzeyong 20 + 20 + 28 or 20 + 20 + 30; 20 + 20 + 2028 (30) + 28 (30) first raise three, the last two
# Include <stdio. h> # Include <Iostream> Using Namespace STD; Int Main (){ // Freopen ("in.txt", "r", stdin ); // Freopen ("out.txt", "W", stdout ); Int T; Int A, B, C; Int Icase = 0 ; Scanf ( " % D " ,& T ); While (T -- ) {Icase ++ ; Scanf ( " % D " , & A, & B ,& C ); Int Res; If (B + C )* 2 > = A) RES =/ 2 + (B + C-/ 2 + A % 2 + 1 )/ 2 ; Else Res = (B + C) + (a-(B + C )* 2 + 2 )/ 3 ; Printf ( " Case % d: % d \ n " , Icase, Res );} Return 0 ;}