struct Elem {
int val;
int op;
int start[2];
int finish[2];
};
Elem MAP[MAXR][MAXC];
int r, c;
int checked[MAXR][MAXC];
void init(int C, int R) {
r = R, c = C;
for (int i = 0; i < R; i++) {
for (int j = 0; j < C; j++)
MAP[i][j].op = MAP[i][j].val = 0;
}
}
int stoi(char str) {
int idx, num;
idx = num = 0;
int flag = 1;
if (!('0'<=str[idx] && str[idx] <= '9')) {
if(str[idx] == '-')
flag = -1;
idx++;
}
do {
num = num 10 + (str[idx] - '0');
} while (str[++idx]);
return num * flag;
}
void divide(char input[],char left, char right) {
int flag = 0;
for (int i = 0; input; input++, i++) {
if (input == ',') {
flag = 1;
continue;
}
if (3 < i && flag == 0)
left++ = input;
if(flag == 1 && input != ')')
right++ = input;
}
right = left = '\0';
}
void set(int col, int row, char input[]) {
int i = row - 1;
int j = col - 1;
if (input[0] <= '9' || input[0] == '-') // 숫자일 경우
MAP[i][j].val = stoi(input);
else {
MAP[i][j].op = 1;
char left[4], right[4];
divide(input, left, right);
MAP[i][j].start[1] = left[0] - 'A';
MAP[i][j].start[0] = stoi(left);
MAP[i][j].finish[1] = right[0] - 'A';
MAP[i][j].finish[0] = stoi(right);
switch (input[2]) {
case 'D':
MAP[i][j].val = 0;
break;
case 'B':
MAP[i][j].val = 1;
break;
case 'L':
MAP[i][j].val = 2;
break;
case 'V':
MAP[i][j].val = 3;
break;
case 'X':
MAP[i][j].val = 4;
break;
case 'N':
MAP[i][j].val = 5;
break;
case 'M':
MAP[i][j].val = 6;
break;
default:
break;
}
}
}
int calc(int i, int j) {
int op = MAP[i][j].val;
if (op == 0);
}
void update(int value[MAXR][MAXC]) {
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++)
checked[i][j] = 0;
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
if (checked[i][j] == 0) {
checked[i][j] = 1;
if (MAP[i][j].op == 0)
value[i][j] = MAP[i][j].val;
else {
include
using namespace std;
define MAXR 99
define MAXC 26
struct Elem { int val; int op; int start[2]; int finish[2]; };
Elem MAP[MAXR][MAXC]; int r, c; int checked[MAXR][MAXC];
void init(int C, int R) { r = R, c = C; for (int i = 0; i < R; i++) { for (int j = 0; j < C; j++) MAP[i][j].op = MAP[i][j].val = 0; } }
int stoi(char str) { int idx, num; idx = num = 0; int flag = 1; if (!('0'<=str[idx] && str[idx] <= '9')) { if(str[idx] == '-') flag = -1; idx++; } do { num = num 10 + (str[idx] - '0'); } while (str[++idx]); return num * flag; }
void divide(char input[],char left, char right) { int flag = 0; for (int i = 0; input; input++, i++) { if (input == ',') { flag = 1; continue; } if (3 < i && flag == 0) left++ = input; if(flag == 1 && input != ')') right++ = input; } right = left = '\0'; }
void set(int col, int row, char input[]) { int i = row - 1; int j = col - 1; if (input[0] <= '9' || input[0] == '-') // 숫자일 경우 MAP[i][j].val = stoi(input); else { MAP[i][j].op = 1; char left[4], right[4]; divide(input, left, right); MAP[i][j].start[1] = left[0] - 'A'; MAP[i][j].start[0] = stoi(left); MAP[i][j].finish[1] = right[0] - 'A'; MAP[i][j].finish[0] = stoi(right); switch (input[2]) { case 'D': MAP[i][j].val = 0; break; case 'B': MAP[i][j].val = 1; break; case 'L': MAP[i][j].val = 2; break; case 'V': MAP[i][j].val = 3; break; case 'X': MAP[i][j].val = 4; break; case 'N': MAP[i][j].val = 5; break; case 'M': MAP[i][j].val = 6; break; default: break; } } }
int calc(int i, int j) { int op = MAP[i][j].val; if (op == 0); }
void update(int value[MAXR][MAXC]) { for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) checked[i][j] = 0; } for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { if (checked[i][j] == 0) { checked[i][j] = 1; if (MAP[i][j].op == 0) value[i][j] = MAP[i][j].val; else {
}
void test() { int R, C; R= C = 5; init(R,C);
}