POJ 1922 Ride to School
来源:互联网 发布:c语言break跳出if 编辑:程序博客网 时间:2024/06/11 21:11
智商,,,,,,训练赛上的题目,注重思路的分析,看解题报告分析的特别好。
#include<cstdio>#include<cmath>using namespace std;int main(){ int vis,time,minn,min; int n; while(scanf("%d",&n)&&n) { int flag=0; for(int i=0; i<n; i++) { scanf("%d %d",&vis,&time); if(time<0) continue; else flag++; minn=ceil(4500.0*3.6/vis+time); if(flag==1) min=minn; else min=min<minn?min:minn; } printf("%d\n",min); } return 0;}ceil函数是向上取整的意思,floor函数是取整数部分,(ceil汉语意思是天花板,而floor是地板)。
错了好几遍,原因在于 if(flag==1)
min=minn;这个没处理好,原来写的是if(i=0) min=minn;如果i=0是,time<0,就出问题了。
多思考,多积累。做题要活跃,发散思维,不要太呆板
- POJ 1922 Ride to School
- POJ 1922 Ride to School
- POJ 1922 Ride to School
- poj 1922 Ride to School
- poj 1922 Ride to School
- POJ 1922 Ride to School
- POJ:1922 Ride to School
- POJ 1922 - Ride to School
- POJ 1922 Ride to School
- POJ 1922 Ride to School
- POJ-1922 Ride to School
- POJ 1922 Ride to School 解题报告
- Ride to School(POJ 1922)
- Ride to School - POJ 1922 水题
- POJ 1922:Ride to School:水题练java
- POJ 1922 Ride to School 简单模拟
- POJ——1922 Ride to School
- POJ 1922:Ride to School 【水】
- web.xml 中的listener、 filter、servlet 加载顺序及其详解
- android 自定义LinearLayout
- oracle 集合
- c++类型-const的使用
- CCS 3.3 操作C函数读写文件
- POJ 1922 Ride to School
- [mini2440]如何配置minicom
- POJ 1562 Oil Deposits
- 9.2图的存储结构 9.2.1 邻接矩阵存储方法
- java中“==”和equals方法有什么区别
- Mina自定义文本编解码
- DOCTYPE作用及用法详解
- 剑指offer面试题22栈的压入弹出序列
- TCP协议学习之 nagle算法