1 solutions
-
0
C++ :
#include <iostream> using namespace std; int countOnes(int num) { int count = 0; while (num > 0) { count += num & 1; num >>= 1; } return count; } int main() { int n; cin >> n; int total = 0; for (int i = 0; i < n; ++i) { int num; cin >> num; total += countOnes(num); } int parity = total % 2; cout << total << " " << parity << endl; return 0; }
- 1
Information
- ID
- 154
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 3
- Accepted
- 2
- Uploaded By