ZOJ Problem Set - 2970 Faster, Higher, Stronger


ZOJ Problem Set - 2970
Faster, Higher, Stronger

Time Limit:1 Second Memory Limit:32768 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 integerT(1 <=T<= 50) which is the number of test cases. And it will be followed byTconsecutive 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 integerNmeaning the number of the records in this test case. The third line hasNpositive 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 SOURCE CODE:
#include<iostream>
#include
<string>
#include
<limits>

using namespace std;

int main()
{
int cases;
cin
>>cases;
while(cases--)
{
string command;cin>>command;
unsigned records;cin
>>records;
if(command == "Faster")
{
unsigned min
= std::numeric_limits<unsigned>::max();
int record;
while(records--)
{
cin
>>record;
if(record < min)
{
min
= record;
}
}
cout
<<min<<endl;
}
else if(command == "Higher" || command == "Stronger")
{
unsigned max
= std::numeric_limits<unsigned>::min();
int record;
while(records--)
{
cin
>>record;
if(record > max)
{
max
= record;
}
}
cout
<<max<<endl;
}
}
return 0;
}

优质内容筛选与推荐>>
1、python 函数操作
2、「ZigBee模块」网络通讯实验-点播、组播、广播
3、序列模型(5)-----双向神经网络(BRNN)和深层循环神经网络(Deep RNN)
4、(Unity4.7)assetbundle 坑爹总结
5、VS误删sln项目文件怎么办


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn