Advertisement
Guest User

Odmienna parzystość

a guest
Mar 30th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int P, NP, IP, INP, N, A;
  5. int main()
  6. {
  7.     cin>>N;
  8.     while(N--)
  9.     {
  10.         cin>>A;
  11.         if(A%2==1)
  12.         {
  13.             INP++;
  14.             NP=A;
  15.         }
  16.         else
  17.         {
  18.             IP++;
  19.             P=A;
  20.         }
  21.  
  22.     }
  23.     if(INP==1)
  24.         cout<<NP;
  25.     else
  26.         cout<<P;
  27.  
  28.  
  29.  
  30.  
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement