【C】#牛牛的10类人#
牛牛的10类人
https://www.nowcoder.com/practice/232b7fc32fac4636819e31a7d7c960a3
#include <stdio.h> int sort(int num) { int num0 = 0, num1 = 0; while (num) { if (num % 2) num1++; else num0++; num /= 2; } if (num0 % 2 == 0 && num1 % 2 != 0) return 0; else if (num0 % 2 != 0 && num1 % 2 == 0) return 1; else if (num0 % 2 == 0 && num1 % 2 == 0) return 10; else return 100; } int main() { int n; scanf("%d", &n); int arr[n]; for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } for (int j = 0; j < n; j++) { printf("%d ", sort(arr[j])); } return 0; }