xibaby @ 2023-12-03 12:38:56
#include<bits/stdc++.h>
using namespace std;
double n,w,b;
int main(){
scanf("%lf",&n);
w=n/1.2;
b=n/3.0+50.0;
if(w>b) printf("Walk");
else if(b>w) printf("Bike");
else printf("All");
return 0;
}
by lpk1118 @ 2023-12-03 12:58:23
@xibaby w大于b时,骑车快,应该输出Bike,w小于b时同理,应输出walk。你写反了。
by noob_bob @ 2023-12-03 12:59:20
代码大意:因为走路的花的时间大于骑车花的时间,所以走路快,反之亦然
by xibaby @ 2023-12-03 13:09:24
@lpk1118 @bob_cai 非常感谢!
by ZX_XYZ @ 2024-01-20 11:08:58
n=int(input()) a=n/1.2 b=n/3+27+23 if a < b: print('Walk') elif b < a: print('Bike') else: print('All')
by lizhuohang2013 @ 2024-01-28 11:25:53
把double改成int就对了