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() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) break;
        int sum = 0;
        int max = 0;
        int min = 100000;
        for (int i = 0; i < n; ++i) {
            int a;
            cin >> a;
            sum += a;
            if (max < a) max = a;
            if (min > a) min = a;
        }
        sum -= min + max;
        cout << sum / (n - 2) << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int MIN,MAX,n,sum,a,i;
int main(){
while(true){
cin>>n;if(!n){break;}
MIN=10000000;
MAX=0;sum=0;
for(i=0;i<n;i++){cin>>a;MIN=min(MIN,a);MAX=max(MAX,a);sum+=a;}
cout<<(sum-MIN-MAX)/n<<endl;
}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n1;
	cin >> n1;
	while (n1 > 0){
		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>
using namespace std;

int main() {
    int n, s;
    while (cin >> n) {
        int mins = 1000, maxs = 0, sum = 0;
        for (int i = 0; i < n; i++) {
            cin >> s;
            sum += s;
            mins = min(s, mins);
            maxs = max(s, maxs);
        }
        sum -= mins + maxs;
        cout << sum / (n - 2) << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	while (cin >> n && n > 0){
		int large = 0;
		int small = 1000;
		int sum = 0;
		for (int i=0; i>n; ++i){
			cin >> s;
			sum = sum + s;
			if (large < s) {large = s};
			if (small > s) {small = s};
		}
		int ans = 0;
		ans = (sum - large - small) / (n - 2);
		cout << ans << endl ;
	}
}

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

int main()
{
	int n,m,i;
	int ave[1000]={0};

	m=0;
	while(1){
		int point[100]={0};
		int min=1000;
		int max=0;
		cin>>n;
		if(n==0) break;
		for(i=0;i<n;i++){
			cin>>point[i];
			if(point[i]>max) max=point[i];
			if(point[i]<min) min=point[i];
			ave[m]++;
		}
		ave[m]=(ave[m]-max-min)/(n-2);
	m++;
	}
	for(i=0;i<m;i++){
		cout<<ave[i]<<endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    vector<int> sss(20);
    for (int l=0;l<20;l++){

int A;
cin >>A;
 if (A==0){
        break;
    }
int cnt=0;
vector<int> vec(A);
for (int i=0;i<A;i++){
    cin >> vec[i];
    cnt+=vec[i];
}
sort(vec.begin(),vec.end());

cout << ((cnt-(vec[0]+vec[A-1]))/(A-2))<<endl;
   
    }
}

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

int main() {
	int n, s;
	int  i;
	int max, min;
	int sum;
	int avg;
	while(cin >> n, n != 0) {
		sum = max = 0;
		min = 11111;
		for(i=0;i<n;i++) {
			cin >> s;
			max = (s > max)?s:max;
			min = (s < min)?s:min;
			sum += s;
		}
		avg = (sum-max-min)/(n-2);
		cout << avg << endl;
	}
	return 0;
}

C++: #include <vector>
#include <iostream>

int main(void){
	bool isPrime[10010];
	std::vector<int> prime,input;
	int i,j,k,ans;

	for(bool b : isPrime) b=true;
	for(i=2;i<10010;++i){
		for(j=i*2;j<10010;j+=i) isPrime[j]=false;
	}
	for(i=2;i<10010;++i){
		if(isPrime[i]) prime.push_back(i);
	}

	while(true){
		std::cin >> i;
		if(i==0) break;
		input.push_back(i);
	}

	for(int in : input){
		ans=0;
		for(i=0;true;++i){
			if(prime[i]>in) break;
			k=in;
			for(j=i;true;++j){
				k-=prime[j];
				if(k<0) break;
				if(k==0) ++ans;
			}
		}
		std::cout << ans << std::endl;
	}
	return 0;
}

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

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0 ;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    int sum=0;
    for (int i=0;i<n-1;i++){
        sum+=a[i];
    }
    cout << (float) sum /(float) (n-2)<<endl;
}

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

int s;
int n,maxn,minn,sum;
int main(){
	while(1){
		cin >> n;
		if(n==0)break;
		minn=1001;
		maxn=0;
		sum=0;
		for(int i=0;i<n;i++){
			cin >>s;
			sum+=s;
			if(maxn<s)maxn=s;
			if(minn>s)minn=s;
		}
		sum=sum-minn-maxn;
		cout <<sum/(n-2)<<endl;

	}
	return 0;
}

C++: #include "iostream"
#include "vector"
#include "array"
#include "string"
#include "algorithm"

using namespace std;
#define rep(p,q) for(int i = p;i < q;i++)

//ICPC Score Totalizer Software
int main(void) {
	int num = 0;
	while (cin >> num && num != 0) {
		vector<int> v = vector<int>();
		int point = 0;
		rep(0, num) {
			cin >> point;
			v.push_back(point);
		}
		sort(v.begin(), v.end());
		int sum = 0;
		rep(1, num - 1) {
			sum += v[i];
		}
		cout << sum / (num - 2) << endl;
	}
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int n;
    int tmp, sum;
    vector<int> s;

    while(true) {
        cin >> n;
        if(n == 0) return 0;
        sum = 0;
        s.clear();
        for(int i = 0; i < n; i++) {
            cin >> tmp;
            s.push_back(tmp);
        }

        sort(s.begin(), s.end());
        for(int i = 1; i < n-1; i++){
            sum += s[i];
        }
        cout << floor(sum * 1.0 / (n-2)) << endl;
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int N,S,sum,mx,mn;
    while(cin >> N && N>0)
    {
        sum = 0;
        mx = -1;
        mn = 1001; 
        for(int i=0; i<N; ++i)
        {
            cin >> S;
            sum += S;
            mx = max(S,mx);
            mn = min(S,mn);
        }
        cout << (sum - mx - mn) / (N - 2) << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	int sinpan,a[100],i,min,max,mini,maxi,sum=0;
	while(1){
		cin>>sinpan;
		if(sinpan==0) break;
		min=1001;
		max=0;
		for(i=0;i<sinpan;i++){
			cin>>a[i];
			if(max<a[i]){
				max=a[i];maxi=i;
			}
			if(min>a[i]){
				min=a[i];mini=i;
			}
		}
		a[maxi]=-1;
		a[mini]=-1;
		for(i=0;i<sinpan;i++){
			if(a[i]!=-1)
			sum+=a[i];
		}
		sum/=(sinpan-2);
		cout<<sum<<endl;
		sum=0;
	}
		return 0;
}

C++: #include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

void solve(int N){
  vector<int> S(N);
  for(int i=0;i<N;i++) cin>>S[i];

  sort(S.begin(),S.end());

  int ans=0;
  for(int i=1;i<N-1;i++) ans+=S[i];
  cout<<ans/(N-2)<<endl;
}

int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0) break;
    solve(n);
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <array>
#include <numeric>

using namespace std;

int main() {
  array<int,100> s;
  int n;
  while ((cin >> n) && n != 0) {
    for (int i=0; i<n; i++) cin >> s[i];
    int ssum = accumulate(s.begin(), s.begin()+n, 0);
    int smax = *max_element(s.begin(), s.begin()+n);
    int smin = *min_element(s.begin(), s.begin()+n);
    cout << (ssum-smax-smin)/(n-2) << endl;
  }
  return 0;
}