guyuefangyuan_kami @ 2024-09-21 12:20:32
#include <iostream>
#include <stdio.h>
#include<math.h>
using namespace std;
int main() {
int a;
cin >> a;
if((a/1.2)<(a/3+50)){
cout<<"Walk";
}else if((a/1.2)==(a/3+50)){
cout<<"All";
}else{
cout<<"Bike";
}
return 0;
}
by YDMaYi @ 2024-09-21 12:36:07
int认真的?
by lichengxi1 @ 2024-09-24 18:01:14
#include <iostream>
#include <stdio.h>
#include<math.h>
using namespace std;
int main() {
int a;
cin >> a;
if((a/1.2)<(a/3.0 + 50.0)){
cout<<"Walk";
}else if((a/1.2)==(a/3.0 + 50.0)){
cout<<"All";
}else{
cout<<"Bike";
}
return 0;
}
你在if
中一定要用a/3.0+50.0
,否则a/3
会自动取整的
by davidzhou3000 @ 2024-10-08 12:41:04
其实可以直接判断n和100的大小关系。n和100一样的时候速度一样快,n比100小走路快,n比100大骑车快