Guest User

Untitled

a guest
Jul 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main()
  9. {
  10.     int n,m,g,t;
  11.     scanf("%d",&n);
  12.     while(n>0)
  13.     {
  14.         vector<int> v;
  15.         int max=0;
  16.         scanf("%d",&m);
  17.         for(int i=0;i<m;i++)
  18.         {
  19.             scanf("%d",&g);
  20.             v.push_back(g);
  21.         }
  22.         for(int i=0;i<v.size();i++)
  23.         {
  24.             for(int j=i;j<v.size();j++)
  25.             {
  26.                 if(v[i]<v[j])
  27.                 {
  28.                     t=v[j]-v[i];
  29.                     if(max<t)
  30.                     max=t;
  31.                 }
  32.             }
  33.         }
  34.         if(max==0)
  35.             printf ("%s \n", "UNFIT");
  36.         if(max>0)
  37.             printf("%d\n",max);
  38.         n--;
  39.     }
  40.     return 0;
  41. }
Add Comment
Please, Sign In to add comment