#include<bits/stdc++.h>
using namespace std;
struct NODE{
string name;
int times, num;
bool good;
};
bool compare(NODE a, NODE b){
return a.times > b.times;
}
bool comp(NODE a, NODE b){
return a.num < b.num;
}
int main(){
int n;
cin>>n;
int Case = 1;
while(n-->0){
NODE arr[10];
for(int i = 0; i < 10; i++){
cin>>arr[i].name>>arr[i].times;
arr[i].num = i;
bool good = 0;
}
sort(arr, arr+10, compare);
int big;
for(int i = 0; i < 10; i++){
if(i == 0){
big = arr[i].times;
}else{
if(big != arr[i].times){
big = i;
break;
}
}
}
NODE great[big];
for(int i= 0; i < big;i++){
great[i].name = arr[i].name;
great[i].num = arr[i].num;
great[i].times = arr[i].times;
}
sort(great, great+big, comp);
cout << "Case #"<<Case<<':'<<'\n';
for(int i = 0; i < big; i++){
cout << great[i].name << '\n';
}
Case++;
}
}
寫了很久為何會RE?