链接http://acm.swust.edu.cn/problem/77/
#include <stdio.h> int main() { double hour,money_hour,money; scanf("%lf %lf",&hour,&money_hour); if(hour<=0||hour>=168) { printf("input is wrong!\n"); } else { if(hour<40) { money=hour*money_hour; } else { if(hour<=60) { money=40*money_hour+(hour-40)*1.5*money_hour; } else { money=40*money_hour+20*1.5*money_hour+(hour-60)*3*money_hour; } } printf("%g\n",money); } return 0; }
时间: 2024-10-19 09:21:30