poj1922
来源:互联网 发布:零点市场调查知乎 编辑:程序博客网 时间:2024/05/16 07:44
贪心啦~\(≧▽≦)/~
题意:一个人骑车去学校,一直在跟别人走,如果没有车来,他就等着,有车来就跟,如果出现了比现在快的车车就跟快的那辆车车,求到达目的地的时间。
思路做法:时间为负的肯定已经先走啦,就可以不用考虑了,即使碰上了也是速度比现在的速度慢的啊。
然后就看时间为正的,然后找到速度最大的,一直跟着走就是了。
所以就是T=s/v+t(等待时间);
AC代码:
#include <cstdio>#include <cstring>#include <math.h>using namespace std;const int maxn=10010;int vi;int start;int n;double time,mintime;int main(){ while(scanf("%d",&n),n) { mintime=3600*4.5; while(n--) { scanf("%d%d",&vi,&start); if(start<0) continue; time=4.5/vi*3600+start; if(time<mintime) mintime=time; } int result=(int)ceil(mintime); printf("%d\n",result); }}
0 0
- poj1922
- poj1922
- poj1922
- POJ1922
- poj1922
- poj1922
- POJ1922-Ride to School
- 1poj1922(贪心)
- POJ1922 Ride to School
- POJ1922 Ride to School
- poj1922 Ride to Office
- POJ1922浅析------Ride to School
- ZOJ2229 POJ1922 HDU1445 Ride to School
- POJ1922-Ride To School (C语言实现)
- javascript的继承机制
- [sg简单应用] poj 1082 Calendar Game
- 业务连续性实战
- 简单算术表达式的求值程序
- android 获取屏幕高度和宽度 的方法
- poj1922
- Mac 下运用LLDB 搭建编译环境
- MMT Demo: Personalization on Hybrid Delivery
- 全面总结Java泛型
- FileUtils 对文件操作
- WinCE NAND flash - FAL
- Spring包含JAR的详解
- iOS 4 多任务和后台运行原理图
- 自定义注解+拦截器实现权限控制