2016年11月5日 星期六

TIOJ 1182 - 競試.黑暗

http://tioj.infor.org/problems/1182

水水的((總覺得我這幾題題解都好混



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include<algorithm>
#include<iostream>
using namespace std;
int n,p,y,mx,mn,s;
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    while(n--){
        cin>>p>>y;
        mx=(1<<29);
        mn=-(1<<29);
        p--;
        while(p--){
            cin>>s;
            if(s<mx && y<s) mx=s;
            if(s>mn && y>s) mn=s;
        }
        cout<<mx<<" "<<mn<<'\n';
    }
}

沒有留言:

張貼留言