(简单模拟2.1.2)POJ 1922 Ride to School(求最小值)

来源:互联网 发布:c语言cos函数怎么求 编辑:程序博客网 时间:2024/06/02 04:59
/* * POJ_1922.cpp * *  Created on: 2013年10月24日 *      Author: Administrator */#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){int n;while(scanf("%d",&n)!=EOF,n){int i;double min = INT_MAX;for(i = 0 ; i < n ; ++i){int v,t;scanf("%d%d",&v,&t);double x;if(t >= 0 && (x = t + 4.5/v*3600)<min ){//t < 0 时不能影响操作结果,因为他已经出发min = x;}}printf("%d\n",(int)ceil(min));}return 0;}

原创粉丝点击