ZOJ 2970 水(F)
2015-11-07 23:29
239 查看
Faster, Higher, Stronger
Time Limit: 2 Seconds Memory Limit: 65536 KB
In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.
The motto of Olympic Games is "Citius, Altius, Fortius", which means "Faster, Higher, Stronger".
In this problem, there are some records in the Olympic Games. Your task is to find out which one is faster, which one is higher and which one is stronger.
Input
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. And it will be followed
by T consecutive test cases.
Each test case has 3 lines. The first line is the type of the records, which can only be "Faster" "Higher" or "Stronger". The second line is a positive integer N meaning the
number of the records in this test case. The third line has N positive integers, i.e. the records data. All the integers in this problem are smaller than 2008.
Output
Results should be directed to standard output. The output of each test case should be a single integer in one line. If the type is "Faster", the records are time records and you should
output the fastest one. If the type is "Higher", the records are length records. You should output the highest one. And if the type is "Stronger", the records are weight records. You should output the strongest one.
Sample Input
Sample Output
Author: XUE, Zaiyue
Source: The 5th Zhejiang Provincial Collegiate Programming Contest
题意:如果是faster输出最小,其余输出最大
Time Limit: 2 Seconds Memory Limit: 65536 KB
In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.
The motto of Olympic Games is "Citius, Altius, Fortius", which means "Faster, Higher, Stronger".
In this problem, there are some records in the Olympic Games. Your task is to find out which one is faster, which one is higher and which one is stronger.
Input
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. And it will be followed
by T consecutive test cases.
Each test case has 3 lines. The first line is the type of the records, which can only be "Faster" "Higher" or "Stronger". The second line is a positive integer N meaning the
number of the records in this test case. The third line has N positive integers, i.e. the records data. All the integers in this problem are smaller than 2008.
Output
Results should be directed to standard output. The output of each test case should be a single integer in one line. If the type is "Faster", the records are time records and you should
output the fastest one. If the type is "Higher", the records are length records. You should output the highest one. And if the type is "Stronger", the records are weight records. You should output the strongest one.
Sample Input
3 Faster 3 10 11 12 Higher 4 3 5 4 2 Stronger 2 200 200
Sample Output
10 5 200
Author: XUE, Zaiyue
Source: The 5th Zhejiang Provincial Collegiate Programming Contest
题意:如果是faster输出最小,其余输出最大
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define LL long long #define N 10000 int a ; #define inf 0x3f3f3f3f int main(){ #ifdef CDZSC freopen("i.txt","r",stdin); #endif char s ; int n,t,x; scanf("%d",&t); while(t--) { int ans; scanf("%s",s); ans=s[0]=='F'?inf:-inf; scanf("%d",&n); while(n--) { scanf("%d",&x); if(s[0]=='H'||s[0]=='S') { ans=max(ans,x); } else { ans=min(ans,x); } } printf("%d\n",ans); } return 0; }
相关文章推荐
- c语言之const理解
- 【分享】PRIMAL×HEARTS1+2 (プライマルハーツ‐)【日文硬盘版】(带全CG存档&日文攻略+打开存档补丁
- 那些人生最重要的转折点
- latex调整字符间距 调整字距
- [RabbitMQ] Connection failed
- 黑马程序员——多线程--线程的创建方式和线程安全的简单介绍
- 解决VS2010链接错误:LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- swift:打造你自己的折线图
- Sublime Text3注册码(可用)
- Git学习札记
- Day 5(11.7):(4)运算符及函数
- OpenGL ES 3.0之Texturing纹理详解(一)
- [转]lsof详解
- Swift 自定义炫酷下拉刷新效果
- 诗友赐玉
- Xcode真机测试could not find developer disk image解决方法
- 博客存在的意义和最近的状态
- Linux C学习笔记
- 一个轻量级rest服务器
- python之函数用法setdefault()