某停车场收费标准如下:30分钟(含)内免费,前3小时收费3元,以后每半小时(含)加1.5元,24小时(含)最高收费30元,如果超过24小时,则按每天30元计算。
请设计程序输入停车分钟数(整数),输出收费金额(以元为单位,结果保留两位小数)。
例如停车40分钟,收费3元,则
输入
30
输出
3.00
以下是一些测试样例的输入
10
30
31
180
181
211
690
691
800
则分别应该输出
price=0.00
price=0.00
price=3.00
price=3.00
price=4.50
price=6.00
price=28.5
price=30.00
price=30.00
代码如下
#include<stdio.h>
//等于强制int,原样输出,不等于,加一输出
int main()
{
double t,price;
while(1)
{
scanf("%lf",&t);
if(t<=30)
{
price = 0;
}
else if(t>30&a