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的更多相关文章
随机推荐
- Django学习(四) Django提供的后台管理系统以及如何定义URL路由
一旦你建立了模型Models,那么Django就可以为你创建一个专业的,可以提供给生成用的后台管理站点.这个站点可以提供给有权限的人进行已有模型Models数据的增删改查. 将新建的模型Models是 ...
- codeforces 519C.. A and B and Team Training
C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...
- struts2_20140720
有这样的感觉:前面学的东西弄会了,过了一段时间又感觉陌生了,还要重新开始.这次想个好办法,把写的程序用博客记录下来,把自己的学历历程用博客的形式呈现出来,一来可以方便复习,而来可以以后开发程序可以快速 ...
- NEC红外遥控协议理解与实现
红外发射管有2个管脚,发送的是经过38KHz时钟调制过的信号.例如下图使用PWM产生一个等占空时钟信号用于调制. 接收管收下来的信号已经经过了解调,可以直接连接系统的外部中断脚. 下面通过逻辑分析仪来 ...
- 以Qemu模拟Linux,学习Linux内核
文章名称:以Qemu模拟Linux,学习Linux内核作 者:five_cent文章地址:http://www.cnblogs.com/senix/archive/2013/02/21/29 ...
- POJ 2892 Tunnel Warfare (SBT + stack)
题意:给定了初始的状态:有n个村庄连成一条直线,现在有三种操作: 1.摧毁一个村庄 2.询问某个村庄,输出与该村庄相连的村庄数量(包括自己) 3.修复被摧毁的村庄,优先修复最近被摧毁的........ ...
- hibernate 非xml实体类配置方法!
hibernate 非xml实体类配置方法! 这个是hibernate.cfg.xml配置文件 <?xml version='1.0' encoding='UTF-8'?> <!DO ...
- MySQL的零碎知识点
让Windows下的MySQL表名大小写敏感: 在mysql查询中执行:SHOW VARIABLES LIKE 'lower_case_table_names'; 值的含义--->0:大小写敏感 ...
- multiset集合容器的集合运算:并、交、差
set和multiset的内部通常是采用平衡二叉树来实现.当放入元素时,会按照一定的排序方法自动排序,默认是按照less<>排序规则来排序.这种自动排序的特性加速了元素查找的过程,但问题是 ...
- 让rdlc报表在ReportViewer中水平居中的方法
正常情况下,rdlc报表在Reportviewer中是居左显示的,如图: 在Reporviewer的属性中,我没有找到能让rdlc的居中显示的方法.网上其他人用的方法都试了,没能实现,只能自己找方法解 ...