Advertisement
STANAANDREY

otema

Oct 21st, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     unsigned simp = 0, spare = 0, n, pos = 0;
  7.     cin >> n;
  8.  
  9.     while (n)
  10.     {
  11.         unsigned cif = n % 10;
  12.         if (pos % 2)
  13.             simp += cif;
  14.         else
  15.             spare += cif;
  16.  
  17.         pos++;
  18.         n /= 10;
  19.     }
  20.  
  21.     if (!(spare % 2) && simp % 2)
  22.         cout << 1;
  23.     else
  24.         cout << 0;
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement