name_x @ 2023-05-16 22:25:23
#include<bits/stdc++.h>
using namespace std;
int main()
{
int bike=50,walk=0;
int km;
cin>>km;
km*=1000;
if((km/3+bike)>(km/1.2))
{
cout<<"Bike";
}
else if((km/3+bike)<(km/1.2))
{
cout<<"Walk";
}
else
{
cout<<"All";
}
return 0;
}
by devdede @ 2023-05-16 22:47:29
double
存精度而不是int
bike
walk
#include<bits/stdc++.h>
using namespace std;
double bike=50.0,walk=0.0;
int main()
{
double km;
cin>>km;
walk=km/1.2;
bike=km/3.0+50.0;
if(walk>bike)
cout<<"Bike";
else if(bike>walk)
cout<<"Walk";
else
cout<<"All";
return 0;
}
by name_x @ 2023-05-17 20:35:34
谢谢谢谢,看的有点晚,感激不尽感激不尽!