Friday, June 24, 2016

UVA 11364 - Parking

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    int T;
    cin>>T;
    while(T--){
        int t , x,mx=0,mn=99;
        cin>>t;
        while(t--){
            cin>>x;
            if(x>mx)mx=x;
            if(x<mn)mn=x;
        }
        cout<<(mx-mn)*2<<'\n';
    }
    return 0;
}

No comments:

Post a Comment