HDU hosts sporting meeting every year.One of the most exciti

HDU hosts sporting meeting every year.One of the most exciting events is the 10000M-running.During the match many students are running on the track.So,how about the rank list now?
As we know,in a running ,we rank the player according to the length everyone has passed .So if one player run 400M(one lap) farther than another player ,it looks like they are running at the same position on the track ,but the rank of the former is much better than the latter.Now given everyone’s position on the track ,and one rank list ,can you tell me whether the rank list is possible.
Input
The first line of input gives the number of cases,T (at most 110).the first line of each case has two intergers,n,m.(1 >lap;
cin>>xx>>rr;
if(n==1&&(xx>=lap||rr!=1))
sign=1;
for(i=1;i>x>>r;
if(!(xrr)||(x>=lap))
sign=1;
xx=x,rr=r;
}
if(sign==1)
cout
MAPLE0211 1年前 已收到2个回答 举报

greenacres 幼苗

共回答了19个问题采纳率:84.2% 举报

参考代码,已经AC:
#include
#include
using namespace std;
typedef struct Sport{
int x;
int rank;
}sport[100];
int cmp(const void *aa,const void *bb)
{
return((*(struct Sport*)aa).rank-(*(struct Sport*)bb).rank);
}
int max_m(int x,int max){
int m=x;
while(m>t;
int max;
while(t--)
{
cin>>n>>m;
max=m;
sign=1;
for(i=0;i>s[i].x>>s[i].rank;
}
qsort(s,n,sizeof(Sport),cmp);
for(i=0;i

1年前

5

nuanfeng17 幼苗

共回答了10个问题 举报

我的代码那错了? #include

1年前

0
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 0.039 s. - webmaster@yulucn.com