Advertisement
Xsufu

Untitled

May 1st, 2020
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. void start();
  6.  
  7. int main(){
  8.    
  9.     start();
  10.    
  11.     system("pause");
  12.     return 0;
  13. }
  14.  
  15. void start(){
  16.     int N, x, max = -1, chek, iMem, jMem;
  17.     cin >> N;
  18.     vector <int> mem(N);
  19.    
  20.     for (int r = 0; r<N; r++){
  21.         cin >> x;
  22.         mem[r] = x;
  23.     }
  24.    
  25.     for (int i = 0; i<N; i++){
  26.         for (int j = 0; j<N; j++){
  27.             if (i!=j){
  28.                 if ( (mem[i]+mem[j])%2!=0 && mem[i]*mem[j]%5 == 0){
  29.                     chek = mem[i]*mem[j]%5;
  30.                     if (chek>=max){
  31.                         iMem = i;
  32.                         jMem = j;
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.     }
  38.    
  39.     cout << mem[iMem] << " " << mem[jMem] << endl;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement