1018. Call, 1018 call

Source: Internet
Author: User

1018. Call, 1018 call
1018. Call (Standard IO) Time Limit: 1000 MS space limit: 262144 KB Specific Limit

The IC Card Telephone Billing standard for a city is as follows: the first time is 0.5 yuan/3 minutes (3 minutes for less than 3 minutes), then 0.2 yuan/1 minute, one minute is counted as one minute. For example, if a person calls 6 minutes 30 seconds, the fee is calculated as 7 minutes and the fee is 1.3 yuan. It is known that the cost of a person making a phone call is x yuan. How long can this person make a call? (Accurate to minutes) Input a real number x to indicate the call cost. The maximum length (accurate to minutes) of the output call ). Sample Input
0.5
Sample output
3
Data range: 0 <x <= 100

Source/Author: exercises 3.5.1

Copyright©China Computer Society
The China Computer Society has the copyright to this topic (including questions and data ).

This Copyright/authorization form applies to all questions added by administrators

 
 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 using namespace std; 5 int main() 6 { 7     double n; 8     cin>>n; 9     if(n<=0.5)10     {11         cout<<3;12         return 0;13     }14     else15     {16         double sum;17         n=n-0.5;18         cout<<(int)(ceil(n/0.2))+3;19     }20     return 0;21 }

 

Related Article

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.