Advertisement
Guest User

Untitled

a guest
May 26th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1.  #include <iostream>
  2.  
  3.  using namespace std;
  4.  int main(){
  5.     short int N;
  6.     short int MaxDigit=0;
  7.     short int MaxDigitMod5=0;
  8.     short int Digit;
  9.     cin>>N;
  10.     for(int i=0;i<N;i++)
  11.     {
  12.         cin>>Digit;
  13.         if((Digit+MaxDigitMod5)%2!=0||(MaxDigit+Digit)%2!=0){
  14.         if(Digit%5==0)
  15.         MaxDigitMod5=Digit;
  16.         else
  17.         MaxDigit=Digit;
  18.     }
  19.          }
  20.      if(MaxDigitMod5!=0&&MaxDigit!=0)
  21.      cout<<MaxDigit<<" "<<MaxDigitMod5==0;
  22.      else
  23.      cout<<"0";
  24.      return 0;  
  25.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement