啊今天好疲惫啊,写了道奇奇怪怪的题,还没解出来,以为可以冒泡或者快速排序,没想到那是数组才可以
?
#include<iostream>
using namespace std;
int main() {
int m, t, w, t2, f, s, u;
cin>> m>> t>> w>> t2>> f>> s>> u;
printf("%.1f", (m + t + w + t2 + f + s + u) * 1.0 / 7);
if (m >= t && m >= w && m >= t2 && m >= f && m >= s && m >= u)cout << " " << m;
else if (t >= m && t >= w && t >= t2 && t >= f && t >= s && t >= u)cout << " " << t;
else if (w >= t && w >= m && w >= t2 && w >= f && w >= s && w >= u)cout << " " << w;
else if (t2 >= t && t2 >= w && t2 >= m && t2 >= f && t2 >= s && t2 >= u)cout << " " << t2;
else if (f >= t && f >= w && f >= t2 && f >= m && f >= s && f >= u)cout << " " << f;
else if (s >= t && s >= w && s >= t2 && s >= f && s >= m && s >= u)cout << " " << s;
else if (u >= t && u >= w && u >= t2 && u >= f && u >= s && u >= m)cout << " " << u;
else if (m <= t && m <= w && m <= t2 && m <= f && m <= s && m <= u)cout << " " << m;
else if (t <= m && t <= w && t <= t2 && t <= f && t <= s && t <= u)cout << " " << t;
else if (w <= t && w <= m && w <= t2 && w <= f && w <= s && w <= u)cout << " " << w;
else if (t2 <= t && t2 <= w && t2 <= m && t2 <= f && t2 <= s && t2 <= u)cout <<" " << t2;
else if (f <= t && f <= w && f <= t2 && f <= m && f <= s && f <= u)cout << " " << f;
else if (s <= t && s <= w && s <= t2 && s <= f && s <= m && s <= u)cout << " " << s;
else if (u <= t && u <= w && u <= t2 && u <= f && u <= s && u <= m)cout << " " << u;
return 0;
}
|