A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Populate the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
I extracted the following code from that output:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Populate the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Running the following program:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Populate the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Total number of unholy 8x8 matrices: 0
main.c: In function 'main':
main.c:30:36: warning: left shift count >= width of type [-Wshift-count-overflow]
30 | for (long long i = 0; i < (1LL << 64); i++) {
| ^~
Testing if the previous output contains the string 1121231537486377866
: False
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
I extracted the following code from that output:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Running the following program:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Total number of unholy 8x8 matrices: 0
main.c: In function 'main':
main.c:30:36: warning: left shift count >= width of type [-Wshift-count-overflow]
30 | for (long long i = 0; i < (1LL << 64); i++) {
| ^~
Testing if the previous output contains the string 1121231537486377866
: False
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
I extracted the following code from that output:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Running the following program:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of i for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Total number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Total number of unholy 8x8 matrices: 0
main.c: In function 'main':
main.c:29:36: warning: left shift count >= width of type [-Wshift-count-overflow]
29 | for (long long i = 0; i < (1LL << 64); i++) {
| ^~
Testing if the previous output contains the string 1121231537486377866
: False
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int is_isolated = 1; // Assume isolated initially // Check neighbors (within bounds) if (i > 0 && matrix[i - 1][j] == 1) is_isolated = 0; if (i < 7 && matrix[i + 1][j] == 1) is_isolated = 0; if (j > 0 && matrix[i][j - 1] == 1) is_isolated = 0; if (j < 7 && matrix[i][j + 1] == 1) is_isolated = 0; if (is_isolated) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // 2^64 possible matrices int matrix[8][8]; for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { // Extract bit corresponding to the current cell matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
I extracted the following code from that output:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int is_isolated = 1; // Assume isolated initially // Check neighbors (within bounds) if (i > 0 && matrix[i - 1][j] == 1) is_isolated = 0; if (i < 7 && matrix[i + 1][j] == 1) is_isolated = 0; if (j > 0 && matrix[i][j - 1] == 1) is_isolated = 0; if (j < 7 && matrix[i][j + 1] == 1) is_isolated = 0; if (is_isolated) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // 2^64 possible matrices int matrix[8][8]; for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { // Extract bit corresponding to the current cell matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Running the following program:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int is_isolated = 1; // Assume isolated initially // Check neighbors (within bounds) if (i > 0 && matrix[i - 1][j] == 1) is_isolated = 0; if (i < 7 && matrix[i + 1][j] == 1) is_isolated = 0; if (j > 0 && matrix[i][j - 1] == 1) is_isolated = 0; if (j < 7 && matrix[i][j + 1] == 1) is_isolated = 0; if (is_isolated) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; // Iterate through all possible 8x8 binary matrices for (long long i = 0; i < (1LL << 64); i++) { // 2^64 possible matrices int matrix[8][8]; for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { // Extract bit corresponding to the current cell matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Number of unholy 8x8 matrices: 0
main.c: In function 'main':
main.c:30:36: warning: left shift count >= width of type [-Wshift-count-overflow]
30 | for (long long i = 0; i < (1LL << 64); i++) { // 2^64 possible matrices
| ^~
Testing if the previous output contains the string 1121231537486377866
: False
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that counts the total number of unholy 8x8 matricies.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
I extracted the following code from that output:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Running the following program:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <stdio.h> #include <stdlib.h> // Function to check if a matrix is unholy int is_unholy(int matrix[8][8]) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 1) { int adjacent_ones = 0; // Check adjacent cells (within bounds) if (i > 0 && matrix[i - 1][j] == 1) adjacent_ones++; if (i < 7 && matrix[i + 1][j] == 1) adjacent_ones++; if (j > 0 && matrix[i][j - 1] == 1) adjacent_ones++; if (j < 7 && matrix[i][j + 1] == 1) adjacent_ones++; if (adjacent_ones == 0) return 0; // Found an isolated 1 } } } return 1; // No isolated 1s found } int main() { long long unholy_count = 0; int matrix[8][8]; // Iterate through all possible 8x8 binary matrices (2^64) for (long long i = 0; i < (1LL << 64); i++) { // Fill the matrix based on the binary representation of 'i' for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { matrix[row][col] = (i >> (row * 8 + col)) & 1; } } if (is_unholy(matrix)) { unholy_count++; } } printf("Number of unholy 8x8 matrices: %lld\n", unholy_count); return 0; } |
Number of unholy 8x8 matrices: 0
main.c: In function 'main':
main.c:30:36: warning: left shift count >= width of type [-Wshift-count-overflow]
30 | for (long long i = 0; i < (1LL << 64); i++) {
| ^~
Testing if the previous output contains the string 1121231537486377866
: False