UVA 12709 Falling Ants(简单的比较大小)
2014-07-02 10:06
204 查看
Input
The input file contains at most 500 test cases. The description of each test case is given below:
First line of each test case contains an integer T (T ≤ 100) which denotes the total number of ants
to consider. Each of the next T lines contains three integers which denote the value of L, W and H
(1 ≤ L,W,H ≤ 50) of an ant respectively.
Input is terminated by a line containing a single zero.
Output
For each set of input produce one line of output. This line contains the volume of the ant that has the
highest downward acceleration. If there is a tie report the ant with the highest volume.
Sample Input
3
3 4 5
12 1 5
20 10 4
3
3 4 5
20 30 5
1 2 4
0
Sample Output
60
3000
AC代码:
#include <stdio.h> //author:XXYY int main(){ int T,l,w,h,maxh,t,max; while(~scanf("%d",&T),T){ t=1; maxh=max=0; while(T--){ scanf("%d%d%d",&l,&w,&h); if(t){ maxh=h; max=l*w*h; t=0; } else{ if(maxh<h){ maxh=h; max=l*w*h; } else if(maxh==h) if(l*w*h>max) max=l*w*h; } } printf("%d\n",max); } return 0; }
相关文章推荐
- 简单的js比较时间的大小
- 简单java应用程序---比较两个数大小
- uva136 优先队列,或者常规做法,比较大小存入数组即可。
- js比较两个日期大小的简单方法
- java通过Comparable接口实现字符串比较大小排序的简单实例
- 一个简单的数据类型判断:占用不同大小字节的变量比较
- javascript简单比较日期大小的方法
- CodeForces 602A Two Bases(简单题,比较两个不同进制数的大小)——Codeforces Beta Round #333 (Div. 2)
- JS 日期比较大小的简单实例
- UVA116----简单的DP,但是输出路径比较坑
- 时间操作(JavaScript版)—最简单比较两个时间格式数据的大小
- UVA 11404 简单LCS模型DP 字典序比较
- javascript简单比较日期大小的方法
- java简单的字符串大小比较——compareTo()方法
- 训练指南 uva 11729 重载运算符比较vector大小
- 2、简单比较数大小程序
- 比之前那个版本更简单的C语言实现的比较大小
- 简单比较版本名称大小,如1.8.1,2.10.0等
- java简单的字符串大小比较——compareTo()方法