Ride to School
Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 18704   Accepted: 7552

Description

Many graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus – Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to school. Due to the bad traffic in Beijing, many students choose to ride a bike.

We may assume that all the students except "Charley" ride from
Wanliu to Yanyuan at a fixed speed. Charley is a student with a
different riding habit – he always tries to follow another rider to
avoid riding alone. When Charley gets to the gate of Wanliu, he will
look for someone who is setting off to Yanyuan. If he finds someone, he
will follow that rider, or if not, he will wait for someone to follow.
On the way from Wanliu to Yanyuan, at any time if a faster student
surpassed Charley, he will leave the rider he is following and speed up
to follow the faster one.

We assume the time that Charley gets to the gate of Wanliu is zero.
Given the set off time and speed of the other students, your task is to
give the time when Charley arrives at Yanyuan.

Input

There
are several test cases. The first line of each case is N (1 <= N
<= 10000) representing the number of riders (excluding Charley). N =
0 ends the input. The following N lines are information of N different
riders, in such format:

Vi [TAB] Ti

Vi is a positive integer <= 40, indicating the speed of the i-th
rider (kph, kilometers per hour). Ti is the set off time of the i-th
rider, which is an integer and counted in seconds. In any case it is
assured that there always exists a nonnegative Ti.

Output

Output one line for each case: the arrival time of Charley. Round up (ceiling) the value when dealing with a fraction.

Sample Input

4
20 0
25 -155
27 190
30 240
2
21 0
22 34
0

Sample Output

780
771

Source

Beijing 2004 Preliminary@POJ
简单模拟,这题目开始看的时候觉得有些复杂, 看到了讨论区别人的思路,但是自己想想想总觉得有问题,可能出题的人也没注意到,或者说题目没叙说清楚吧,不过这题精度要是卡的很准的。
 #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std; int main()
{
int n;
const double distance = 4.5;
while(scanf("%d",&n)!=EOF&&n!=)
{
double x,t,v,min = 1e100;
for(int i = ;i<n;i++)
{
scanf("%lf%lf",&v,&t);
x =distance*/v+t;
if(t>=&&x<min)
min = x;
}
printf("%.0lf\n",ceil(min));
}
return ;
}

poj1922的更多相关文章

随机推荐

  1. Asp.net MVC4 下二级联动

    效果图:

  2. SQL Server 的各种查询和要申请的锁

    前期准备: 1.建表 create table T_Btree(X int primary key,Y nvarchar(4000));            create table T_Heap( ...

  3. MEMS加速度计工作原理

    一般加速度计有两块芯片组成,一块是MEMS传感器,另一块是客户化的信号处理芯片. 加速度计也称惯性传感器,因为它的工作原理就是靠MEMS中可移动部分的惯性.由于中间电容板的质量很大,而且它是一种悬臂构 ...

  4. QT下的几种透明效果(三种方法:调色板,透明度属性,自绘)

    1.窗口整体透明,但是窗体上的控件不透明.    通过设置窗体的背景色来实现,将背景色设置为全透.  QPalette pal = palette();  pal.setColor(QPalette: ...

  5. wireshark 过滤条件汇总

    原文地址:http://blog.const.net.cn/a/9340.htm 一.针对wireshark最常用的自然是针对IP地址的过滤.其中有几种情况: (1)对源地址为192.168.0.1的 ...

  6. ACM学习-POJ-1003-Hangover

    菜鸟学习ACM,纪录自己成长过程中的点滴. 学习的路上,与君共勉. ACM学习-POJ-1003-Hangover Hangover Time Limit: 1000MS   Memory Limit ...

  7. linux(边压缩边传输边解压)

    比如我要转移旧VPS /home/wwwroot 下的web目录到新VPS(123.123.123.123)的/home/wwwroot 目录下   1.进入目录 cd /home/wwwroot  ...

  8. C#初步接触

    如同非常多刚開始学习的人一样,刚接触C#的时候,也是一头雾水,学习了好长时间,都搞不清楚一些基本名称是什么.什么是C#?什么是.net?什么是visual studio?它们之间有什么关系?以下我们就 ...

  9. 网络配置——Linux运维基础

    今天把Linux的网络配置总结了一下,尽管并不难可是是个比較重要的基础.然后我也不知到自己以后是否会做运维,可是我知道自己比較喜欢刨根问底.还有就是我很珍惜我以前掌握过的这些运维的技能.今天突然间问自 ...

  10. 好用的DNS服务器推荐

    DNS在平时上网中扮演重要角色,如果不注意DNS的话,可能会导致网速慢.弹窗广告.网址打不开.打开不是自己想要的网站.淘宝客劫持等一系列问题.针对DNS的问题,网络上也有各种DNS平台供用户选择.这里 ...