fork download
  1. #include <stdio.h>
  2. #define MAX(x, y) ((x) > (y) ? (x) : (y))
  3.  
  4. int main(void)
  5. {
  6. int x, y, z;
  7. for (y = 1; y < 9; y++)
  8. {
  9. for (x = 1; x < 9; x++)
  10. {
  11. z = MAX(MAX(x, y) / 2, (x + y) / 3);
  12. z += x + y + z & 1;
  13. z += (x + y == 3 || x == y && (x | y | 1) == 3) * 2;
  14. printf("%2d", z);
  15. }
  16. puts("");
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
 0 3 2 3 2 3 4 5
 3 4 1 2 3 4 3 4
 2 1 4 3 2 3 4 5
 3 2 3 2 3 4 3 4
 2 3 2 3 4 3 4 5
 3 4 3 4 3 4 5 4
 4 3 4 3 4 5 4 5
 5 4 5 4 5 4 5 6