diff options
Diffstat (limited to '2023/16')
| -rw-r--r-- | 2023/16/16a.c | 5 | ||||
| -rw-r--r-- | 2023/16/16b.c | 4 |
2 files changed, 2 insertions, 7 deletions
diff --git a/2023/16/16a.c b/2023/16/16a.c index 0f95553..79aba38 100644 --- a/2023/16/16a.c +++ b/2023/16/16a.c | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdio.h> | 1 | #include <stdio.h> |
| 3 | #include <stdlib.h> | ||
| 4 | #include <string.h> | ||
| 5 | 2 | ||
| 6 | #define M 200 | 3 | #define M 200 |
| 7 | 4 | ||
| @@ -25,7 +22,7 @@ void walk(int i, int j, int d) { | |||
| 25 | if (!entered[i][j]) s++; | 22 | if (!entered[i][j]) s++; |
| 26 | entered[i][j] |= d; | 23 | entered[i][j] |= d; |
| 27 | for (int k = 1; k <= 8; k <<= 1) | 24 | for (int k = 1; k <= 8; k <<= 1) |
| 28 | if (k & turn[d][map[i][j]]) | 25 | if (k & turn[d][(int)map[i][j]]) |
| 29 | walk(i+go[k][0], j+go[k][1], k); | 26 | walk(i+go[k][0], j+go[k][1], k); |
| 30 | } | 27 | } |
| 31 | 28 | ||
diff --git a/2023/16/16b.c b/2023/16/16b.c index ce42c31..6247942 100644 --- a/2023/16/16b.c +++ b/2023/16/16b.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdio.h> | 1 | #include <stdio.h> |
| 3 | #include <stdlib.h> | ||
| 4 | #include <string.h> | 2 | #include <string.h> |
| 5 | 3 | ||
| 6 | #define M 200 | 4 | #define M 200 |
| @@ -26,7 +24,7 @@ void walk(int i, int j, int d) { | |||
| 26 | if (!entered[i][j]) s++; | 24 | if (!entered[i][j]) s++; |
| 27 | entered[i][j] |= d; | 25 | entered[i][j] |= d; |
| 28 | for (int k = 1; k <= 8; k <<= 1) | 26 | for (int k = 1; k <= 8; k <<= 1) |
| 29 | if (k & turn[d][map[i][j]]) | 27 | if (k & turn[d][(int)map[i][j]]) |
| 30 | walk(i+go[k][0], j+go[k][1], k); | 28 | walk(i+go[k][0], j+go[k][1], k); |
| 31 | } | 29 | } |
| 32 | 30 | ||
