The 5th Zhejiang Provincial Collegiate Programming Contest---ProblemF:Faster, Higher, Stronger

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2970

唔。。。第二水题。除了Faster是输出最小外,另外两个都是输出最大的。

#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int t,i;
    string s;
    int n,a[10001];
    cin>>t;
    while(t--) {
        cin>>s>>n;
        for(i=0; i<n; i++)
            cin>>a[i];
        sort(a,a+n);
        if(s[0]=='F')
            cout<<a[0]<<endl;
        else
            cout<<a[n-1]<<endl;
    }
    return 0;
}

 

你可能感兴趣的:(The 5th Zhejiang Provincial Collegiate Programming Contest---ProblemF:Faster, Higher, Stronger)