Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created July 2, 2012 07:16
Show Gist options
  • Save kunishi/3031641 to your computer and use it in GitHub Desktop.
Save kunishi/3031641 to your computer and use it in GitHub Desktop.
ACM International Collegiate Programming Contest, Japan Domestic, 2007, Problem A
#include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
int i;
int max, min;
int score;
int count;
int sum;
while (1) {
scanf("%d", &number);
if (number == 0) {
exit(0);
}
max = -1;
min = 10000;
sum = 0;
for (i = 0; i < number; i ++) {
scanf("%d", &score);
if (score < min) {
min = score;
}
if (score > max) {
max = score;
}
sum += score;
}
printf("%d\n", (sum - min - max)/(number - 2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment