Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,i,x,mem,a1,a2;
  8.     int maxi = 0;
  9.     vector <int> a(150,0);
  10.     cin >> n;
  11.     for(i = 0;i < n;i++)
  12.     {
  13.         cin >> x;
  14.         mem = a[(110-(x % 110)) % 110];
  15.         if(mem != 0 && mem > x)
  16.         {
  17.             if(x + mem > maxi)
  18.             {
  19.                 maxi = mem + x;
  20.                 a1 = mem;
  21.                 a2 = x;
  22.             }
  23.         }
  24.         if(x > a[x % 110])
  25.             a[x % 110] = x;
  26.     }
  27.     cout << a1 << " " << a2 << endl;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement