Untitled

mail@pastecode.io avatar
unknown
csharp
7 months ago
611 B
3
Indexable
Never
/* hw8-1.h */
#include <stdio.h>
#include <stdlib.h>

void init(int*** mp) {
    int i, j, k;
    for (i = 0; i < 130; i++) {
        mp[i] = (int**)malloc(130 * sizeof(int*));
        for (j = 0; j < 130; j++) {
            mp[i][j] = (int*)malloc(130 * sizeof(int));
            for (k = 0; k < 130; k++) {
                mp[i][j][k] = 1;
            }
        }
    }
}

void modify(int* a, int val) {
    *a = val;
}

int query(int**** mp, char a[4], char b[4]) {
    int val_a = (*mp)[a[0]][a[1]][a[2]];
    int val_b = (*mp)[b[0]][b[1]][b[2]];

    return (val_a + val_b) % 2;
}
Leave a Comment