#include<stdio.h>
int main()
{
int area;//定义区域
int n;
char t;//用来接收输入的','
float weight,h;//定义重量和续重
t=',';
scanf("%d%c%f",&area,&t,&weight);//输入区域和重量
n=(int)(weight);
if(weight<=0)
printf("输入重量有误");
else
{
if(weight==n)//判断重量是否为整数
{
h=n-1;//重量为整数则续重减去1公斤
}
else
{
h=n+1-1;//重量不是整数时续重减去1公斤后要加1,因为1.3公斤要按2公斤算
}
switch(area)//根据输入的数字确定执行的命令
{
case 0:printf("Price: %5.2f\n",10+h*3);break;
case 1:printf("Price: %5.2f\n",10+h*4);break;
case 2:printf("Price: %5.2f\n",15+h*5);break;
case 3:printf("Price: %5.2f\n",15+h*6.5);break;
case 4:printf("Price: %5.2f\n",15+h*10);break;
default:printf("Error in Area\nPrice:%5.2f\n",0);break;//当输入的数字不在0-4范围内时输出错误
}
}
return 0;
}