#include <iostream>
#include <cstdlib> //system("pause");
#include <algorithm>
using namespace std;
//1.重点:当需要表示关系组合数据时,学会使用结构体
struct period{
int start;
int end;
double aver;
};
//2.重点:学会使用sort函数 (#include <algorithm>)
bool compare(period a, period b)
{
if(a.aver > b.aver)
return 1;
if(a.aver == b.aver && (a.end - a.start > b.end - b.start))
return 1;
if(a.aver == b.aver && (a.end - a.start == b.end - b.start) && (a.end < b.end))
return 1;
return 0;
}
int main(){
int N;
cin >> N;
struct period p[100000];
for(int i=0;i<N;i++){
int qN;
int bestpN;
int minqN;
int plane[300];
cin >> qN >> bestpN >> minqN;
for(int j=0;j<qN;j++){
cin >> plane[j];
}
//3.重点:三次循环,例如:分别是(5、6、、、n)(1-5,2-6,、、、,(n-5)-n)(1到5累加)
int c=0;
for(int sampleqN=minqN;sampleqN<=qN;sampleqN++){
for(int t=0;t+sampleqN<=qN;t++){
double sum=0;
for(int k=t;k-t<sampleqN;k++){
sum = sum+plane[k];
}
p[c].start=t+1;
p[c].end=t+sampleqN;
p[c].aver=sum/sampleqN;
c++;
}
}
//2.重点:学会使用sort函数 (#include <algorithm>)
sort(p,p+c,compare);
cout << "Result for run "<< i+1 << ":" << endl;
for(int k=0; k<bestpN && k<c; k++){
cout << p[k].start << "-" << p[k].end << endl;
}
}
//system("pause");
return 0;
}