分类: PHP
2013-01-15 20:42:53
a = (x == 0000)
b = (x > 0000) c = (x & 0101 == 0001或0100或0000) d = (x & 0001 == 0000)
a + b + c + d == 2
for($x = 0; $x < 16; $x++) { $a = $x == 0; $b = $x > 0; $c = in_array($x & 5, array(0, 1, 4)); $d = ($x & 1) == 0; $r = $a + $b + $c + $d; if($r == 2) { printf('谁说真话?甲:%1$d 乙:%2$d 丙:%3$d 丁:%4$d', $a, $b, $c, $d); echo "\n"; printf('谁是罪犯?甲:%1$d 乙:%2$d 丙:%3$d 丁:%4$d', (bool)($x & 8), (bool)($x & 4), (bool)($x & 2), (bool)($x & 1)); echo "\n\n"; } }