Centuy @ 2024-12-28 09:26:59
#include <bits/stdc++.h>
using namespace std;
double Distance;
double Bike_time, Walk_time;
int main() {
cin >> Distance;
Bike_time = Distance / 3.00 + 27.00 + 23.00;
Walk_time = Distance / 1.20;
if (Bike_time > Walk_time) {
cout << "Walk";
} else if (Bike_time < Walk_time) {
cout << "Bike";
} else {
cout << "ALL";
}
return 0;
}
by Rigil_Kent @ 2024-12-28 09:37:27
All
而非 ALL
by Lsy013111 @ 2024-12-28 09:56:46
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int x, b, w;
cin >> x;
b = x / 3 + 50;
w = x / 1.2;
if (b < w) {
cout << "Bike";
} else if (w < b) {
cout << "Walk";
} else if (w = b) {
cout << "All";
}
return 0;
}
这样就能过,不要太麻烦
by YHX_50537 @ 2024-12-28 10:05:05
by Rigil_Kent @ 2024-12-28 11:29:41
@Lsy013111
虽然你的做法这题能过,但涉及实数计算的还是建议使用 double
。
by Centuy @ 2024-12-28 18:40:47
@Rigil_Kent 感谢,已关
by Lsy013111 @ 2024-12-28 21:43:40
@Rigil_Kent@Rigil_Kent
QwQ 我不道啊