【HDUhostssportingmeetingeveryy-查字典问答网
分类选择

来自倪维健的问题

  【HDUhostssportingmeetingeveryyear.Oneofthemostexcitingeventsisthe10000M-running.Duringthematchmanystudentsarerunningonthetrack.So,howabouttheranklistnow?Asweknow,inarunning,weranktheplayeraccordingtothelengtheve】

  HDUhostssportingmeetingeveryyear.Oneofthemostexcitingeventsisthe10000M-running.Duringthematchmanystudentsarerunningonthetrack.So,howabouttheranklistnow?

  Asweknow,inarunning,weranktheplayeraccordingtothelengtheveryonehaspassed.Soifoneplayerrun400M(onelap)fartherthananotherplayer,itlooksliketheyarerunningatthesamepositiononthetrack,buttherankoftheformerismuchbetterthanthelatter.Nowgiveneveryone’spositiononthetrack,andoneranklist,canyoutellmewhethertheranklistispossible.

  Input

  Thefirstlineofinputgivesthenumberofcases,T(atmost110).thefirstlineofeachcasehastwointergers,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

1回答
2020-12-04 23:06
我要回答
请先登录
郭密

  参考代码,已经AC:

  #include

  #include

  usingnamespacestd;

  typedefstructSport{

  intx;

  intrank;

  }sport[100];

  intcmp(constvoid*aa,constvoid*bb)

  {

  return((*(structSport*)aa).rank-(*(structSport*)bb).rank);

  }

  intmax_m(intx,intmax){

  intm=x;

  while(m>t;

  intmax;

  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

2020-12-04 23:10:30

最新问答

推荐文章

猜你喜欢

附近的人在看

推荐阅读

拓展阅读

  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  •