fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a, b, c, d, e;
  7. cin >> a >> b >> c >> d >> e;
  8.  
  9. int tong_le = (a % 2) * a + (b % 2) * b + (c % 2) * c + (d % 2) * d + (e % 2) * e;
  10. int tong_chan = ((a + 1) % 2) * a + ((b + 1) % 2) * b + ((c + 1) % 2) * c + ((d + 1) % 2) * d + ((e + 1) % 2) * e;
  11.  
  12. cout << abs(tong_le - tong_chan);
  13. return 0;
  14. }
Success #stdin #stdout 0s 5324KB
stdin
1 2 3 4 5
stdout
3