首页 > 代码库 > 贪心/poj 1922 Ride to School

贪心/poj 1922 Ride to School

 1 #include<cstdio> 2 #include<cmath> 3 using namespace std; 4 int n,ans,v,t; 5 int main() 6 { 7     scanf("%d",&n); 8     while (n!=0) 9     {10         ans=0x7fffffff;11         for (int i=1;i<=n;i++)12         {13             scanf("%d%d",&v,&t);14             if (t>=0)15             {16                 int y=int(ceil(4500/(v*10.0/36.0)))+t;17                 if (ans>y) ans=y;18             }19         }20         printf("%d\n",ans);21         scanf("%d",&n);22     }23     return 0;24 }

 

贪心/poj 1922 Ride to School