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 }