题解 | #公务员面试#
公务员面试
https://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97
#include <iostream>
#include<iomanip>
using namespace std;
double mx(int a, int b) {
if (a > b)return a;
else return b;
}
double mn(int c, int d) {
if (c < d)return c;
else return d;
}
int main() {
double a, b, c, d, e, f, g;
double avg;
double max, min;
while (cin >> a >> b >> c >> d >> e >> f >> g) {
max = mx(a, b);
max = mx(max, c);
max = mx(max, d);
max = mx(max, e);
max = mx(max, f);
max = mx(max, g);
min = mn(a, b);
min = mn(min, c);
min = mn(min, d);
min = mn(min, e);
min = mn(min, f);
min = mn(min, g);
avg = (a + b + c + d + e + f + g - max - min) / 5;
cout << setiosflags(ios::fixed) << setprecision(2);
cout << avg << endl;
}
}
// 64 位输出请用 printf("%lld")

vivo公司福利 364人发布