http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2349
中譯
http://luckycat.kshs.kh.edu.tw/homework/q11364.htm
#include "stdio.h"
int main()
{
int t,n;
scanf(" %d",&t);
while( t )
{
int i,min=100,max=0,x;
scanf(" %d",&n);
for(i = 0;i < n;i++)
{
scanf(" %d",&x);
if( x > max )
max = x;
if( x < min )
min = x;
}
printf("%d\n",(max - min) * 2);
t--;
}
return 0;
}
沒有留言:
張貼留言