ACM的题目 用C++写 A Runing GameTime Limit:2000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)Total Submission(s):13 Accepted Submission(s):0Problem DescriptionHDU hosts sporting meeting every year.One of the most exciting events
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 04:41:24
ACM的题目 用C++写 A Runing GameTime Limit:2000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)Total Submission(s):13 Accepted Submission(s):0Problem DescriptionHDU hosts sporting meeting every year.One of the most exciting events
ACM的题目 用C++写
A Runing Game
Time Limit:2000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)
Total Submission(s):13 Accepted Submission(s):0
Problem Description
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
ACM的题目 用C++写 A Runing GameTime Limit:2000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)Total Submission(s):13 Accepted Submission(s):0Problem DescriptionHDU hosts sporting meeting every year.One of the most exciting events
我写的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