找最值。
#include <stdio.h>
int main()
{
int te;
int n;
int min;
int max;
int t;
scanf("%d", &te);
while(te--)
{
scanf("%d", &n);
scanf("%d", &t);
min = t;
max = t;
n--;
while(n--)
{
scanf("%d", &t);
if(t > max)
{
max = t;
}
if(t < min)
{
min = t;
}
}
printf("%d\n", max - min);
}
}