Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. int main()
  4. {
  5. int x, y, z,i, max,min,d;
  6. scanf("%d",&x);
  7. while (x--)
  8. {
  9. scanf("%d",&y);
  10. max=0;
  11. min=50000;
  12. for (i=0;i<y;i++)
  13. {
  14. scanf("%d",&z);
  15. if (max<z) max=z;
  16. if (min>z) min=z;
  17. }
  18. d=(max-min)*2;
  19. printf("%d\n",d);
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement