ZOJ 2970 Faster, Higher, Stronger
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu
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
题目意思:输入Faster的时候 输出最小的值,输入Higher和Stronger的时候输出最大的值
sort一下之后输出判断一下就ok了
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
int main()
{
int a;
scanf("%d",&a);
while(a--)
{
char b[];
scanf("%s",b);
int n,m[];
scanf("%d",&n);
for(int i=;i<n;i++)
{
scanf("%d",&m[i]);
}
sort(m,m+n);
if(!strcmp(b,"Faster"))
printf("%d\n",m[]);
if(!strcmp(b,"Higher")||!strcmp(b,"Stronger"))
printf("%d\n",m[n-]);
}
return ;
}
ZOJ 2970 Faster, Higher, Stronger的更多相关文章
- The 5th Zhejiang Provincial Collegiate Programming Contest---ProblemF:Faster, Higher, Stronger
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2970 唔...第二水题.除了Faster是输出最小外,另外两个都是输出最大 ...
- nenu contest3 The 5th Zhejiang Provincial Collegiate Programming Contest
ZOJ Problem Set - 2965 Accurately Say "CocaCola"! http://acm.zju.edu.cn/onlinejudge/showP ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- QDU_组队训练(ABEFGHKL)
A - Accurately Say "CocaCola"! In a party held by CocaCola company, several students stand ...
- YOLO 论文阅读
YOLO(You Only Look Once)是一个流行的目标检测方法,和Faster RCNN等state of the art方法比起来,主打检测速度快.截止到目前为止(2017年2月初),YO ...
- August 13th 2016 Week 33rd Saturday
What makes life dreary is the want of motive. 没有目标与动力,生活便会郁闷无光. Without dreams and hope, there will ...
- SOME USEFUL MACHINE LEARNING LIBRARIES.
from: http://www.erogol.com/broad-view-machine-learning-libraries/ http://www.slideshare.net/Vincenz ...
- 目标检测之YOLO V2 V3
YOLO V2 YOLO V2是在YOLO的基础上,融合了其他一些网络结构的特性(比如:Faster R-CNN的Anchor,GooLeNet的\(1\times1\)卷积核等),进行的升级.其目的 ...
随机推荐
- MySQL参数设置
InnoDB配置 从MySQL 5.5版本开始,InnoDB就是默认的存储引擎并且它比任何其它存储引擎的使用要多得多.那也是为什么它需要小心配置的原因. 1 innodb_file_per_table ...
- 使用nginx sticky实现基于cookie的负载均衡【转】
在多台后台服务器的环境下,我们为了确保一个客户只和一台服务器通信,我们势必使用长连接.使用什么方式来实现这种连接呢,常见的有使用nginx自带的ip_hash来做,我想这绝对不是一个好的办法,如果前端 ...
- 众签demo
众签demo using System; using System.Collections.Generic; using System.Linq; using System.Text; using S ...
- MVVM模式的模式简介
MVVM模式简介 MVVM是Model.View.ViewModel的简写,这种模式的引入就是使用ViewModel来降低View和Model的耦合,说是降低View和Model的耦合.也可以说是是降 ...
- Python基础:内置异常(未完待续)
本文根据Python 3.6.5的官文Built-in Exceptions编写,不会很详细,仅对Python的内置异常进行简单(重难点)介绍——很多异常都可以从名称判断出其意义,罗列所有的内置异常. ...
- MySQL触发器Trigger实例篇
定义: 何为MySQL触发器? 在MySQL Server里面也就是对某一个表的一定的操作,触发某种条件(Insert,Update,Delete 等),从而自动执行的一段程序.从这种意义上讲触发器是 ...
- Java线程:新特征-有返回值的线程《转》
原始文章 在Java5之前,线程是没有返回值的,常常为了“有”返回值,破费周折,而且代码很不好写.或者干脆绕过这道坎,走别的路了. 现在Java终于有可返回值的任务(也可以叫做线程)了. ...
- Ubuntu下apache2启动、停止、重启、配置
Linux系统为Ubuntu 一.Start Apache 2 Server /启动apache服务# /etc/init.d/apache2 startor$ sudo /etc/init.d/ap ...
- 关于整型Integer、Int32、Int64、IntPtr、UINT、UInt32、Cardinal、UInt64、UIntPtr、NativeUInt、Pointer、Handle
知识点1:UIntPtr = NativeUInt = Pointer = Handle 随程序的位数改变而改变.如下: 所以以后再用指针的时候要这样:UintPtr/NativeUInt(实例) = ...
- 20155225 2006-2007-2 《Java程序设计》第四周学习总结
20155225 2006-2007-2 <Java程序设计>第四周学习总结 教材学习内容总结 对"是一种"语法测试几次之后,总结一句:满足"是一种" ...