Go: // ICPC 得点集計ソフトウェア
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for	{
		n := nextInt(sc)
		if n == 0 { break }

		score_list := []int{}
		for i := 0; i < n; i++ {
			score_list = append(score_list, nextInt(sc))
		}

		// 最低点と最高点を取り除く (3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1:len(score_list)-1]

		// 平均点を求める
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

C++: #include<iostream>
 
using namespace std;
 
int main(){
 
  int n;
 
  while(cin>>n){
 
 
 
    if(n==0){
      break;
    }
    int a[n];
    int max,min;
 
    max=0;
    min=1000;
 
    for(int i=0;i<n;i++){
      cin>>a[i];
 
      if(a[i]>max){
    max=a[i];
      }
 
      if(a[i]<min){
    min=a[i];
      }
    }
 
    int sum;
 
    sum=0;
 
    for(int p=0;p<n;p++){
      sum=sum+a[p];
    }
 
    sum=sum-max-min;
 
   
 
    cout << sum/(n-2) << endl; 
 
    
 
  }
 
   
 
 
 
  return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int n,a,sum,ma,mi;
  while(scanf("%d",&n),n){
    sum = 0;
    ma = 0;
    mi = 1001;
    for(int i=0;i<n;i++){
      scanf("%d",&a);
      sum += a;
      ma = max(ma,a);
      mi = min(mi,a);
    }
    sum -= ma+mi;
    printf("%d\n",sum/(n-2));
  }
  return (0);
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#define M 1111111
int sosu[M];

int main(){
	
	while(1){
		int a;
		cin>>a;
		if(a==0)break;
		
		int b[1111]={0};
		
		rep(i,a){
			int c;
			cin>>c;
			b[c]++;
		}
		
		int ans = 0;
		int st = -1;
		int en = 0;
		rep(i,1111){
			if(b[i]!=0){
				if(st==-1)st=i;
				en = i;
				ans += i*b[i];
			}
		}
		
		ans -= st+en;
		printf("%d\n",ans/(a-2));
	}
}

C++: 
#include <iostream>
using namespace std;

int main()
{
	int number;
	int score, sum, max, min;
	
	while(true)
	{
		cin >> number;
		if(!number) return 0;
		sum = 0, max = 0, min = 1000;
		for(int i = 0; i < number; ++i)
		{
			cin >> score;
			sum += score;
			if(score > max) max = score;
			if(score < min) min = score;
		}
		cout << (sum - max - min) / (number - 2) << endl;
	}
}

C++: #include <iostream>
using namespace std;

void totalize(int n)
{
    int min = 1000, max = 0;
    int s, total = 0;
    for (int i = 0; i < n; i++) {
        cin >> s;
        total += s;
        if (s < min) {
            min = s;
        } else if (max < s) {
            max = s;
        }
    }
    cout << (total - max - min) / (n - 2) << endl;
}

int main()
{
    int n;
    while (true) {
        cin >> n;
        if (n == 0) {
            break;
        }
        totalize(n);
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n1;
	cin >> n1;
	int a[100000] = { 0 };
	for (int i = 0; i < n1; i++){
		cin >> a[i];
	}
	sort(a, a + n1);
	a[0] = { 0 };
	a[n1 - 1] = { 0 };
	for (int i2 = 1; i2 < n1; i2++){
		a[0] += a[i2];
	}
cout << a[0] / (n1 - 2) << endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	vector<int> ansvec;
	for (;;){
		int n;
		cin >> n;
		if (n == 0) break;

		int tmpmin = 1001;
		int tmpmax = -1;
		int tmpans = 0;
		for (int i = 0; i < n; i++){
			int s;
			cin >> s;
			tmpmin = min(s, tmpmin);
			tmpmax = max(s, tmpmax);
			tmpans += s;
		}
		tmpans -= (tmpmin + tmpmax);
		tmpans /= (n - 2);
		ansvec.push_back(tmpans);
	}

	for (int ans : ansvec){
		cout << ans << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    vector<int> v;
    for(int i=0;i<n;++i){
      int tmp;
      cin >> tmp;
      v.push_back(tmp);
    }
    sort(v.begin(),v.end());
    int ans=0;
    for(int i=1;i<n-1;i++){
      ans += v[i];
    }
    cout << ans / (n-2) << endl;

  }
  return 0;
}

C++: #include <stdio.h>

int main(){
    int n,s[100]={0};
	int max,min,max1,min1;
	int sum,i;

scanf("%d",&n);

do{
	max=0;
	min=100000;
	sum=0;
	sum=0;
    max1=0;
    min1=0;
	for (i=0;i<n;i++){
		scanf("%d",&s[i]);
		if(s[i]>max){
            max=s[i];
			max1=i;
		}
		if(s[i]<min){
			min=s[i];
            min1=i;
		}
	}
	for(i=0;i<n;i++){
		if(i!=max1&&i!=min1){
			sum+=s[i];
		}
	}
	printf("%d\n",sum/(n-2));
	scanf("%d",&n);
}while (n!=0);
return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector<T> >;

int main() {
  vi results;

  while (true) {
    int count;
    cin >> count;
    if (count == 0) { break; }
    vi point(count);
    for (int i = 0 ; i < count ; i++) {
      cin >> point[i];
    }
    int max_point = -1;
    int min_point = 1001;
    int ave = 0;
    for (int i = 0 ; i < point.size() ; i++) {
      ave += point[i];
      if (max_point < point[i]) {
        max_point = point[i];
      }
      if (min_point > point[i]) {
        min_point = point[i];
      }
    }
    ave -= (max_point + min_point);
    ave /= (count-2);
    results.push_back(ave);
  }

  for (int i = 0 ; i < results.size() ; i++) {
    printf("%d\n", results[i]);
  }

  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(void)
{
    while(1){
        int n;
        scanf(" %d", &n);
        if(n == 0)
            break;
        vector<int> s;

        for(int i = 0; i < n; i++){
            int tmp;
            scanf(" %d", &tmp);
            s.push_back(tmp);
        }
        sort(s.begin(), s.end());

        int sum = 0;
        for(int i = 1; i < n - 1; i++)
            sum += s[i];
        printf("%d\n", sum / (n-2));
    }
    return 0;
}