HDU 3573 buy sticks (mathematical law)

Source: Internet
Author: User
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  ;} 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.