poj1922
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 18704 | Accepted: 7552 |
Description
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
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
Sample Input
4
20 0
25 -155
27 190
30 240
2
21 0
22 34
0
Sample Output
780
771
Source
#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的更多相关文章
随机推荐
- jquery load(URL,FUNCTION(){}) 异步加载页面
$("#btnSearch").click(function () { var queryUrl = '/Report/LoadInsClassifFileNew'; if ($( ...
- Linux命令(持续更新ing)
*.命令语法: a.在进行参数设定时,通常为“-”号,若为完整参数名称,则输入“--”符号; b.指令太长的时候,可以使用“\”符号使指令连续到下一行; c.各种符号的意义: '' ...
- 【写一个自己的js库】 4.完善跨浏览器事件操作
1.阻止冒泡. function stopPropagation(event){ event = event || getEvent(event); if(event.stopPropagation) ...
- Windows Components Reference(Windows组件参考)
原文 http://www.msfn.org/board/topic/127287-windows-components-reference/ green means the component na ...
- 三校联考 Day3
三校联考 Day3 大水题 题目描述:给出一个圆及圆上的若干个点,问两个点间的最远距离. solution 按极角排序,按顺序枚举,显然距离最远的点是单调的,线性时间可解出答案. 大包子的束缚 题目描 ...
- [SQL]一个删选数据的例子,使用GROUP、DISTINCT
今天遇到的问题,纠结了一上午,终于解决了.在此记录下来,自我认为还有很多类似的问题都可以套用这段代码. 需求描述: 一个表MyImage,列有:号码ID,路径PATH 如: ID PATH 1 C ...
- JS属性
1.类型分析: js中的数据类型有undefined,boolean,number,string,object等5种,前4种为原始类型,第5种为引用类型. 代码: var a1;var a2 = tr ...
- MySQL之终端(Terminal)管理数据库、数据表、数据的基本操作(转)
MySQL有很多的可视化管理工具,比如“mysql-workbench”和“sequel-pro-”. 现在我写MySQL的终端命令操作的文章,是想强化一下自己对于MySQL的理解,总会比使用图形化的 ...
- jQuery基础---Ajax基础教程(二)
jQuery基础---Ajax进阶 内容提纲: 1.加载请求 2.错误处理 3.请求全局事件 4.JSON 和 JSONP 5.jqXHR 对象 发文不易,转载请注明出处! 在 Ajax 基础一篇中, ...
- 必须知道的ADO.NET 数据库连接池
http://www.cnblogs.com/liuhaorain/archive/2012/02/19/2353110.html 题外话 通过前几章的学习,不知道大家对ADO.NET有一定的了解了没 ...