POJ1922

1616阅读 1评论2010-05-24 renqingwei123
分类:

/*
重要的不是会先遇到谁,而是会和谁走到最后

*/
#include
#include
#include
#include
#include
using namespace std;
struct xpoint{
 int speed;
 int offsettime;
 double finishtime;
};
bool isShorter(const xpoint &p1,const xpoint &p2)
{
 return p1.offsettime}
int main()
{
 int N;
 xpoint temp;
 while(scanf("%d",&N))
 {
  list indata;
  if(N==0)
   break;
  for(int i=0;i  {
   scanf("%d%d",&temp.speed,&temp.offsettime);
   temp.finishtime=temp.offsettime+16200.0/double(temp.speed);
   if(temp.offsettime>=0)
    indata.push_back(temp);
  }
  stable_sort(indata.begin(),indata.end(),isShorter);
  list::iterator iptr,iptr2,iptrtemp;
  iptr=indata.begin();
  for(iptr2=indata.begin();iptr2!=indata.end();iptr2++)
  {
   if(iptr2->finishtimefinishtime)
   {
    iptr=iptr2;
   }
  }
  printf("%d\n",(int)ceil(iptr->finishtime));
 }
 return 0;
}
上一篇:参加了GCJ,感觉还行
下一篇:网易2010-5-24练习赛C题

文章评论