fork download
  1. import std.algorithm;
  2. import std.string;
  3. import std.range;
  4. import std.stdio;
  5.  
  6. void main ()
  7. {
  8. foreach (s; 0..16)
  9. {
  10. int counter = 0;
  11.  
  12. bool fun (int x, int y)
  13. {
  14. counter++;
  15. return !(s & (1 << x)) == !(s & (1 << y));
  16. }
  17.  
  18. if ((fun (0, 2) && fun (1, 3)) || (fun (0, 3) && fun (1, 2)))
  19. {
  20. }
  21.  
  22. writeln (format ("%04b", s).retro, ": ", counter);
  23. }
  24. }
  25.  
Success #stdin #stdout 0s 3804KB
stdin
Standard input is empty
stdout
0000: 2
1000: 2
0100: 4
1100: 2
0010: 3
1010: 2
0110: 3
1110: 3
0001: 3
1001: 3
0101: 2
1101: 3
0011: 2
1011: 4
0111: 2
1111: 2