Problem Type : Ad hoc
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#define MAX 1000
using namespace std;
struct node
{
string s;
int value;
};
node arr[MAX];
bool comp(node x,node y)
{
return x.value > y.value;
}
int main()
{
int test,i,j,m,pick,cou=0;
string s1;
scanf("%d",&test);
getchar();
while(test--)
{
cou++;
for(i=0; i<10; i++)
{
cin >> s1 >> m;
arr[i].s=s1;
arr[i].value=m;
}
sort(arr,arr+10,comp);
pick= arr[0].value;
printf("Case #%d:\n",cou);
for(i=0; i<10; i++)
{
if(pick==arr[i].value)
{
cout << arr[i].s <<endl;
}
}
}
return 0;
}
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#define MAX 1000
using namespace std;
struct node
{
string s;
int value;
};
node arr[MAX];
bool comp(node x,node y)
{
return x.value > y.value;
}
int main()
{
int test,i,j,m,pick,cou=0;
string s1;
scanf("%d",&test);
getchar();
while(test--)
{
cou++;
for(i=0; i<10; i++)
{
cin >> s1 >> m;
arr[i].s=s1;
arr[i].value=m;
}
sort(arr,arr+10,comp);
pick= arr[0].value;
printf("Case #%d:\n",cou);
for(i=0; i<10; i++)
{
if(pick==arr[i].value)
{
cout << arr[i].s <<endl;
}
}
}
return 0;
}
No comments:
Post a Comment