Untitled
unknown
c_cpp
a year ago
502 B
1
Indexable
Never
#include <iostream> using namespace std; int main() { int n; int a; cin >> n; cin >> a; if (n > 0 and a > 0) { cout << "NO"; } if (n < 0 and a < 0) { cout << "NO"; } if (n > 0 and a < 0) { a =-a; } if (n < 0 and a > 0) { n =-n; } if (n % 2 == 0 and a % 2 == 0) { cout << "NO"; } if (n % 2 > 0 and a % 2 > 0) { cout << "NO"; } if (n % 2 == 0 and a % 2 > 0) { cout << a + n; } if (n % 2 > 0 and a % 2 == 0) { cout << a + n; } }