Advertisement
Najmul_Kabir

parking

Aug 29th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include
  2.  
  3. int main()
  4. {
  5. int t,ns,sd;
  6. scanf("%d",&t);
  7.  
  8. while(t--)
  9. {
  10. int max=0;
  11. int min=100;
  12.  
  13. scanf("%d",&ns);
  14. while(ns--)
  15. {
  16.  
  17. scanf("%d",&sd);
  18. if(sd>max)
  19. {
  20. max=sd;
  21. }
  22. if(sd<min)
  23. {
  24. min=sd;
  25. }
  26. }
  27. printf("%d\n",2*(max-min));
  28. max=0;
  29. min=0;
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement