Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73287 Py自测 08打车费用 C++ Accepted 1 MS 272 KB 1083 2024-05-18 15:40:25

Tests(10/10):


Code:

/* 例程: 周末,格莱尔和爸爸打车到游乐场玩。 打车计价方案为: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; }