这题只能用位运算,用a%2就不能过。
a%2
#include <bits/stdc++.h> using namespace std; int main() { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); int a; cin >> a; if (a & 1) cout << "odd" << endl; else cout << "even" << endl; return 0; }