CSP201709-1: soy sauce, soy sauce csp201709-1
Introduction:CSP (http://www.cspro.org/lead/application/ccf/login.jsp) is a "Computer vocational qualification certification" examination initiated by CCF, perform capability certification for professionals in computer software development, software testing, information management, and other fields. The subjects of certification are those who are engaged in or will be engaged in IT professional technical and technical management personnel, as well as review subjects for university recruitment and postgraduate students.
James took N yuan to buy soy sauce. 10 yuan for soy sauce, a bottle, sellers for promotion, each buy 3 bottles to send 1 bottle, or each buy 5 bottles to send 2 bottles. How many bottles of soy sauce can James get at most.
The first line contains an integer N, indicating the amount of money Xiaoming can use to buy soy sauce. N is an integer multiple of 10, and N cannot exceed 300.
Output an integer to indicate the maximum number of soy sauce bottles that James can obtain.
40
5
Divide 40 yuan into 30 yuan and 10 yuan, buy 3 bottles and 1 Bottle respectively, 3 of which give 1 bottle, get 5 bottles in total.
80
11
Divide 80 yuan into 30 yuan and 50 yuan, buy 3 bottles and 5 bottles respectively, of which 3 bottles give 1 bottle, 5 bottles give 2 bottles, a total of 11 bottles.
- Scale and conventions of evaluation cases
For all evaluation cases, 1 ≤ n ≤ 1000, 1 ≤ k ≤ artificial, 1 ≤ ai ≤.
# Include <stdio. h> # Include <stdlib. h> # Include <memory. h> Int main (void) { Int money; // The amount of money. Scanf ("% d", & money ); Int bottle = money/10; // Number of bottles Int five = bottle/5; Int three = (bottle-five * 5)/3; Int rest = bottle-five * 5-three * 3; Int total = five * 7 + three * 4 + rest; Printf ("% d \ n", total ); Return 0; } |