题解 | #公务员面试#
公务员面试
https://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97?tpId=290&tqId=309321&ru=%2Fpractice%2Fb8e6a46992fe4e11b2822b20561b6d94&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E8%25AF%25AD%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D290
//看题解基本不是用数组写的,用数组写的话不能多组输入,突然想到这样写就成了 #include<stdio.h> int main() { int arr[7] = {0}; int i = 0, max = 0, min = 100, sum = 0; while (scanf("%d", &arr[i]) != EOF) { if (arr[i] > max) max = arr[i]; if (arr[i] < min) min = arr[i]; sum += arr[i]; i++; if (i == 7) { printf("%.2f\n", (sum - max - min) / 5.0); i = 0, max = 0, min = 100, sum = 0; } } return 0; }