Run ID:73287
提交时间:2024-05-18 15:40:25
/* 例程: 周末,格莱尔和爸爸打车到游乐场玩。 打车计价方案为:2千米内起步是6元;超过2千米之后按1.8元/千米计价; 超过10千米之后在1.8元/千米的基础上加价50%,如图示。 此外,停车等候则按时间计费每3分钟加收1元(注:不满3分钟不计费)。 */ #include <typeinfo> //变量类型头文件,还是有问题;无法判断int #include <iostream> //包含输入输出流头文件iostream using namespace std; //指明程序 使用命名空间std(标准) int main() { int path_l,time_sj; //path_l,time_sj代表路程,停车时间 float cost=0; //cost代表费用 cin>>path_l; //输入路程 if (path_l>10) //当路程大于10公里时 cost=6+(10-2)*1.8+(path_l-10)*1.8*1.5; else if (path_l>2) cost=6+(path_l-2)*1.8; else cost=6; cin>>time_sj; //输入停车时间 cost+=(time_sj/3)*1; //计算停车费用 cout<<cost<<endl; return 0; }