#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a < b && b < c) { cout << a << " " << b << " " << c; } else { if (b < a && a < c) { cout << b << " " << a << " " << c; } else { if (c < a && a < b) { cout << c << " " << a << " " << b; } else { if (a < c && c < b) { cout << a << " " << c << " " << b; } else { if (b < c && c < a) { cout << b << " " << c << " " << a; } else { cout << c << " " << b << " " << a; } } } } } return 0; } 为什么这样80分???
共 2 条回复
#include <bits/stdc++.h> using namespace std; int main() { int a, s, d; cin >> a >> s >> d; if (a > s) swap(a, s); if (a > d) swap(a, d); if (d < s) swap(s, d); cout<<a<<" "<<s<<" "<<d;
}
没有考虑数字相同的情况, 比如 1 2 1