Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include
- int main()
- {
- int t,ns,sd;
- scanf("%d",&t);
- while(t--)
- {
- int max=0;
- int min=100;
- scanf("%d",&ns);
- while(ns--)
- {
- scanf("%d",&sd);
- if(sd>max)
- {
- max=sd;
- }
- if(sd<min)
- {
- min=sd;
- }
- }
- printf("%d\n",2*(max-min));
- max=0;
- min=0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement