3 条题解
-
1
这道题很简单,先算骑车的时间,骑车时间是有多少米远/3.0(3.0是车速,且得用3.0隐藏转换)+23+27(23+27是上下车加开锁锁车)=骑车的时间,再算走路的时间,走路时间是有多少米远/1.2(1.2是走路的速度,且得用1.2隐藏转换=走路的时间,在比较后,骑车快就输出"Bike",走路快就输出"Walk",一样快就输出"All"。
#include<bits/stdc++.h>//老写头文件很烦所以都写上了 #include <iostream> #include <cstdio> #include <cmath> using namespace std; int main() { int n; //x是骑车的时间,y是走路的时间,n是多少米 double x,y; scanf("%d",&n); x=n/3.0+23+27; //计算骑车要多久 y=n/1.2; //计算走路要多久 if (x<y){printf("Bike");} else if(x>y){printf("Walk");} else {printf("All");} return 0; }
- 1
信息
- ID
- 154
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 198
- 已通过
- 140
- 上传者