1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int cmp(const void *a,const void *b)
 4 {
 5     return *(int *)a-*(int *)b;  //升序
 6 }
 7 int main()
 8 {
 9     int t,n,i;
10     int a[110];
11     scanf("%d",&t);
12     while(t--)
13     {
14         scanf("%d",&n);
15         for(i=0;i<n;i++)
16         scanf("%d",a+i);
17         qsort(a,n,sizeof(a[0]),cmp);
18         printf("%d\n",a[n-1]-a[0]);
19     }
20     system("pause");
21     return 0;
22 }

相关文章:

  • 2021-11-24
  • 2022-02-01
  • 2021-10-09
  • 2021-10-02
  • 2022-01-11
  • 2022-12-23
  • 2021-08-05
猜你喜欢
  • 2021-09-27
  • 2021-09-29
  • 2021-07-22
  • 2022-12-23
  • 2021-05-18
  • 2021-08-09
  • 2022-12-23
相关资源
相似解决方案