题解 | #牛牛的10类人#
牛牛的10类人
https://www.nowcoder.com/practice/232b7fc32fac4636819e31a7d7c960a3
#include <stdio.h>
int main() {
int a, b;
int test(int x);
scanf("%d",&a);
int arr[1000];
int i,j;
for(i=0;i<a;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<a;i++)
{
test(arr[i]);
}
}
int test(int x)
{
int g;
int e;
while(x>0)
{
if(x%2==0)
{
g++;
}
else {
e++;
}
x=x/2;
}
if(g%2==0&&e%2!=0)
{
printf("0 ");
}
else if(g%2!=0&&e%2==0)
{
printf("1 ");
}
else if(g%2==0&&e%2==0)
{
printf("10 ");
}
else {
printf("100 ");
}
return 0;
}
广发银行公司氛围 23人发布