CSP201709-1: soy sauce, soy sauce csp201709-1

Source: Internet
Author: User

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.

 

  • Problem description

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.

  • Input Format

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 Format

Output an integer to indicate the maximum number of soy sauce bottles that James can obtain.

  • Sample Input

40

  • Sample output

5

  • Example

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.

  • Sample Input

80

  • Sample output

11

  • Example

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 ≤.

 

  • Source code

# 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;

}

 

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.