链接:click here
题意:
1 7 Refreshing 5 745 Rock_Restart 4 510 LeadWill 4 679 APTX4869 5 374 WaterCop 5 607 ISAP 5 638 TLE 4 902
APTX4869
代码:
#include <math.h>
#include <queue>
#include <deque>
#include <vector>
#include <stack>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define Max(a,b) a>b?a:b
#define Min(a,b) a>b?b:a
#define mem(a,b) memset(a,b,sizeof(a))
int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
const double eps = 1e-6;
const double Pi = acos(-1.0);
static const int inf= ~0U>>2;
static const int maxn =110;
struct node
{
char id[25];
int num;
int time;
}
aa[maxn];
bool cmp(node a,node b)
{
return a.num!=b.num?a.num>b.num:a.time!=b.time?a.time<b.time:strcmp(a.id,b.id)<0;
}
int main()
{
int t,n,i;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0; i<n; i++)
scanf("%s%d%d",aa[i].id,&aa[i].num,&aa[i].time);
sort(aa,aa+n,cmp);
//printf("%d\n",aa[0].num);
printf("%s\n",aa[0].id);
}
return 0;
}
When you want to give up, think of why you persist until now!
NYOJ 707 A Simple Problem(结构体排序) 睡前一水~~
原文:http://blog.csdn.net/u013050857/article/details/43919705