zoj-2970-Faster, Higher, Stronger
来源:互联网 发布:原地堆排序 js 编辑:程序博客网 时间:2024/06/08 05:59
Description
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
按照题目把跑的最快的,跳得最高的,最强壮的输出来
#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;int main(){ int t,n; int a[3000],b[3000],c[3000]; char s[10]; scanf("%d",&t); while(t--) { scanf("%s",s); if(strcmp(s,"Faster")==0) { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); printf("%d\n",a[0]); } else if(strcmp(s,"Higher")==0) { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&b[i]); sort(b,b+n); printf("%d\n",b[n-1]); } else if(strcmp(s,"Stronger")==0) { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&c[i]); sort(c,c+n); printf("%d\n",c[n-1]); } } return 0;}
- ZOJ 2970 Faster, Higher, Stronger
- zoj-2970-Faster, Higher, Stronger
- ZOJ 2970Faster, Higher, Stronger
- ZOJ 2970 Faster, Higher, Stronger(排序)
- [查找最大最小]ZOJ 2970 Faster, Higher, Stronger
- ZOJ-2970-Faster, Higher, Stronger【5th浙江省赛】
- zoj2970----------------Faster, Higher, Stronger
- Faster, Higher, Stronger
- zoj2970 Faster, Higher, Stronger
- ZOJ2970-Faster, Higher, Stronger
- ZJU oj 2970 Faster, Higher, Stronger(水题)
- F - Faster, Higher, Stronger --- (first qualifying)
- 2014ACM集训13级PK赛5-Faster, Higher, Stronger
- The 5th Zhejiang Provincial Collegiate Programming Contest---ProblemF:Faster, Higher, Stronger
- YOLO9000: Better, Faster, Stronger
- YOLO9000: Better,Faster,Stronger
- YOLO9000: Better, Faster, Stronger
- 【笔记】YOLO9000: Better, Faster, Stronger
- Neural Network
- laravel(二)migration
- Struts2之Action请求方式与参数传递的方式总结
- word 的使用
- 状态栏
- zoj-2970-Faster, Higher, Stronger
- convertView中的TAG的理解
- Tomcat源码分析--一次HTTP请求过程
- html5绘制变形图形-变换坐标原点
- JS显示日期和时间以及星期
- 一个使用了nodejs+express的简单jsonp接口模拟脚本
- ios 变速效果
- Windows 7/Windows Server 2008 R2中创建扩展分区
- hdoj-1586-Fibonacci