讲解下这题的怎么做“A Runing Game ” ... (HUD)

[复制链接]
查看11 | 回复2 | 2011-7-20 19:43:53 | 显示全部楼层 |阅读模式
A Runing Game
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 2 Accepted Submission(s) : 1
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
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
#include
using namespace std;
int cmp(int a,int b)
{
return a>b;
}
int t,rank[101],l[101],rr[101],ll[101];
int main()
{

scanf("%d",&t);

while(t--)

{
int lap=0;

int n,m;

scanf("%d%d",&n,&m);

for(int i=0;im )
printf("NO\n");
else
printf("YES\n");
}

return 0;
}

回复

使用道具 举报

千问 | 2011-7-20 19:43:53 | 显示全部楼层
#include #include struct Player{
int x;
int rank;};inline int cmp(const void *a,const void *b){
return ((Player *)b)->rank-((Player *)a)->rank;}int main(){
int t;
scanf("%d",&t);
while(t--)
{
int n,m;
scanf("%d%d",&n,&m);
Player player[n];
f...
回复

使用道具 举报

千问 | 2011-7-20 19:43:53 | 显示全部楼层
根据名次快速排序。看位置序列, 每一次出现连续两个的后者比前者位置数大 就至少需要再多一圈, 最后看需要的圈数是否超过距离了。 当然也要考虑到第一位的人如果超过终点位置的话还需要再多一圈...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行