poj1922
来源:互联网 发布:免费php虚拟主机 编辑:程序博客网 时间:2024/06/04 18:49
题目大意:
Wanliu校区到Yanyuan校区长4.5千米。Charley在Wanliu校区门口开始骑自行车去Yanyuan校区,他始终跟在一个人后面,如果有另一个人超过了他,那他就跟着另一个人。问Charley最后到达Yanyuan校区的时间
解题思路:
问题看似很复杂,其实就是看每个人谁最先到达目的地,因为Charley始终跟在最快的人后面
代码如下:
#include<stdio.h>#include<string.h>#include<math.h>#include<stdlib.h>int main(){ int num; int speed,arr; int time; double tmp; while(scanf("%d",&num)&&num!=0) { time=1000000000; while(num--) { scanf("%d",&speed); scanf("%d",&arr); if(arr<0) continue; tmp=(4.5*3600*1.0)/speed+arr; //printf("%lf\n",tmp); if(tmp<time) { if(tmp>(int)tmp) time=(int)tmp+1; else time=tmp; } } printf("%d\n",time); } return 0;}
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语言实现)
- eclipse启动错误之一(failed to load the JNI shared library)!
- 一段js面向对象的写法
- ArcGis for JS 利用QueryTask查询实现对地图的定位功能
- ThinkPHP查询数据库时各种条件设置
- Android 6.0中SELinux的TE简介
- poj1922
- 03-S3C2440u-boot学习之u-boot分析之Makefile结构分析
- 自动调光
- 2017.2.9
- Servlet学习之Filtering概述
- poj1928
- 基础练习 杨辉三角形 (一维数组)
- MySQL数据库(表)的导入导出(备份和还原)
- 二叉树知识总结http://www.banzg.com/archives/649.html