Go: // Entrance Examination(入学試験)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1600&lang=jp
package main

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

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

	for {
		m, nMin, nMax := nextInt(sc), nextInt(sc), nextInt(sc)
		if m == 0 && nMin == 0 && nMax == 0 {
			break
		}

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

		gapMax, pass := 0, 0
		for n := nMin; n <= nMax; n++ {
			gap := points[n-1] - points[n]
			if gap >= gapMax {
				gapMax, pass = gap, n
			}
		}

		fmt.Println(pass)
	}
}

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

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

using namespace std;

int main(){
 int p[210];
 int m,nm,nM,sub=0,ans;
 while(1){
  cin >> m >> nm >> nM;
  if(m==0)break;
  sub = 0;
  int i;
  for(i=1;i<=m;i++){
   cin >> p[i];
   if(nm<i && i<=nM+1){
    if(p[i-1]-p[i] > sub){
     sub=p[i-1]-p[i];
     ans=i-1;
    }
   }
  }
  cout << ans << endl;
 }
 return 0;
}

C++: #include <bits/stdc++.h>

int m, min, max;
int P[256];

int main() {
  for(;;) {
    scanf("%d %d %d", &m, &min, &max);
    if( m == 0 and min == 0 and max == 0 ) break;
    for(int i = 1; i <= m; ++i) {
      scanf("%d", &P[i]);
    }
    std::sort(P + 1, P + 1 + m);
    std::reverse(P + 1, P + 1 + m);
    int res = -1, maxdiff = -1;
    for(int i = min; i <= max; ++i) {
      int diff = P[i] - P[i+1];
      if( maxdiff <= diff ) {
        maxdiff = diff;
        res = i;
      }
    }
    printf("%d\n", res);
  }
  
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	while(1){
		int m,nmin,nmax; cin >> m >> nmin >> nmax; if(m==0) return 0;
		int a[205];
		for(int i=1;i<=m;i++) cin >>a[i];
		int X = -1,ans =-1;
		for(int i=nmin;i<=nmax;i++){
			if(X <= a[i]-a[i+1]){
				X=a[i]-a[i+1]; ans=i;
			}
		}
		cout<<ans<<endl;
	}
}

C++: Last login: Mon Dec 26 14:34:37 on console
sira-no-MacBook-Air:~ sira$ ls
Desktop		Downloads	Movies		Pictures
Documents	Library		Music		Public
sira-no-MacBook-Air:~ sira$ cd Desktop/
sira-no-MacBook-Air:Desktop sira$ ls
Programing
sira-no-MacBook-Air:Desktop sira$ cd Programing/
sira-no-MacBook-Air:Programing sira$ ls
A-un_Breathing
Curry_Making
Entrance_Examination
Hanafuda_Shuffle
Koto_Municipal_Subway
Score_Totalizer
Selection_of_Participants_of_an_Experiment
vim.txt
sira-no-MacBook-Air:Programing sira$ cd Entrance_Examination/
sira-no-MacBook-Air:Entrance_Examination sira$ ls
Sample.dat	work		work.cpp
sira-no-MacBook-Air:Entrance_Examination sira$ vim work.cpp



                vector<int> data(m);
                for(i = 0; i < m; i++){
                        cin >> data[i];
                }   

                vector<int> diff(m-1);
                for(i = 0; i < m-1; i++){
                        diff[i] = data[i] - data[i+1];
                }

                for(i = nmin-1; i < nmax; i++){
                        if(diff[i] >= Diff){
                                Diff = diff[i];
                                num = i;
                        }
                }
                cout << num + 1 << endl;
                vector<int>().swap(data);
                vector<int>().swap(diff);
        }
        return 0;
}

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

int main(){
  int m,ns,nd,P[201];
  cin >> m >> ns >> nd;
  for(int i=0;i<m;i++){
    cin >> P[i];
  }
  int ans = 0;
  int mmax = -1;
  for(int i=nd;i>=ns;i--){
    int gapp = P[i-1] - P[i];
    if(mmax < gapp){
      mmax = gapp;
      ans = i;
    }
  }
  cout << ans << endl;
}

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

int main(int argc, char const *argv[])
{
	int m,nmi,nma;
	while(cin>>m>>nmi>>nma,m)
	{
		--nmi,--nma;
		int p[m];
		for (int i = 0; i < m; ++i) cin>>p[i];
		int ans=-1,gap=-1;
		for (int i = nmi; i <= nma; ++i)
		{
			if(p[i]-p[i+1]>=gap) ans=i,gap=p[i]-p[i+1];
		}
		cout<<ans+1<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int n,a,b;
    while(cin >> n >> a >> b){
        if(n == 0 && a == 0 && b == 0)return 0;
        vector<int> vec;
        for(int q = 0;q < n;q++){
            int e;cin >> e;
            vec.push_back(e);
        }
        sort(vec.begin(), vec.end());
        int ma = -1e9;
        int ans = 0;
        for(int i = n-b-1;i < n-a;i++){
            if(vec.at(i+1) - vec.at(i) > ma){
                ma = vec.at(i+1) - vec.at(i);
                ans = n-i-1;
            }
        }
        cout<<ans<<endl;
    }
}

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

bool solve() {
    int M, Nmin, Nmax;
    cin >> M >> Nmin >> Nmax;
    if (M == 0 && Nmin == 0 && Nmax == 0) {
        return false;
    }
    int p[200];
    for (int j = 0; j < M; j++) {
        cin >> p[j];
    }

    int ind = Nmin-1;
    for (int j = Nmin; j < Nmax; ++j) {
        if (p[j]-p[j+1] >= p[ind]-p[ind+1]) {
            ind = j;
        }
    }
    cout << ind+1 << endl;
    return true;
}

int main() {
    for(;solve(););
    return 0;
}

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

using namespace std;

int main() {
	int m, nmin, nmax;
	while (cin >> m >> nmin >> nmax) {
		if (m == 0 && nmin == 0 && nmax == 0) {
			break;
		}
		vector<int> d(m);
		for (int i = 0; i < m; i++) {
			cin >> d[i];
		}
		int MAX = d[nmin-1]-d[nmin];
		int maxn = nmin;
		for (int i = nmin-1; i <= nmax-1; i++) {
			int mm = d[i]-d[i+1];
			if (mm >= MAX) {
				MAX = mm;
				maxn = i+1;
			}
			//cout << MAX << ' ' << maxn << endl;
		}
		cout << maxn << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
  int m,n1,n2,p,res;
  while(cin >> m >> n1 >> n2, m|n1|n2){
    vector<int> a;
    for(int i=0;i<m;i++){
      cin >> p;
      a.push_back(p);
    }
    res = n1;
    for(int i=n1,g=0;i<=(m==n2?n2-1:n2);i++){
      // cout << i << " " << a[i-1]-a[i] << endl;
      if(g<=a[i-1]-a[i]){
	res=i;
	g=a[i-1]-a[i];
      }
    }
    cout << res << endl;
  }
}

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

int main(){
	while(1){
		int m,n1,n2;//n2は最大人数
		cin>>m>>n1>>n2;

		if(m==0&&n1==0&&n2==0)
			break;
		
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		
		int gap=-1;
 		int n=-1;

 		for(int i=n1;i<=n2;i++){
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=i;
			}
		}

		cout<<n<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> ivv;


int main()
{
	int m,nmin,nmax;
	
	while(cin >> m >> nmin >> nmax,m)
	{
		int score[m];
		REP(i,m)
		{
			cin >> score[i];
		}
		
		int ans = 0,maxgap = 0;
		
		for(int i = nmin-1;i <= nmax-1;i++)
		{
			if(maxgap <= score[i] - score[i+1])
			{
				ans = i+1;
				maxgap = score[i] - score[i+1];
			}
		}
		
		cout << ans << endl;
		
	}
	
	
	return 0;
}