#31653: C


hehe6969 (hehe6969)

學校 : 不指定學校
編號 : 199246
來源 : [59.120.140.251]
最後登入時間 :
2023-02-12 12:08:13
e511. 11364 - Parking -- UVA | From: [49.216.47.147] | 發表日期 : 2022-08-12 16:12

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) 
{
    int t,n,xi;
    scanf("%d",&t);
    for(int i=t;i>0;i--)
    {
        scanf("%d",&n);
        int max=0,min=99;
        for(int I=n;I>0;I--)
        {
            scanf("%d",&xi);
            if(xi>max)
            {
                max=xi;
            }
            if(xi<min)
            {
                min=xi;
            }
        }
        printf("%d\n",(max-min)*2);
    }
    
    return 0;
}

 
ZeroJudge Forum