839.2009.C.四.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#include <stdio.h>
#include <string.h>

void print(int x)
{
if(x == 0) return;
print(x/2);
putchar(x%2 ? 'T':'F');
}

int main()
{
int A = 466;//01 1101 0010 True 1 False 0
int B = 236;//00 1110 1100
int C = 699;//10 1011 1011
int ans = 0;
int lim = 1<<10;
for(ans = 0; ans < lim; ++ans)
{
if(__builtin_popcount(ans^A) == 3
&& __builtin_popcount(ans^B) == 3
&& __builtin_popcount(ans^C) == 3)
{
print(ans);
puts("");
}
}
}