-29. From One Corner to Another
user_6817964
c_cpp
2 years ago
432 B
4
Indexable
void compute(int x, int y, int r, int c, int *count){ if (x + 1 < c && y + 1 < r) { (*count)++; compute(x + 1, y, r, c, count); compute(x, y + 1, r, c, count); } else if (x + 1 < r) { compute(x + 1, y, r, c, count); } else if (y + 1 < c) { compute(x, y + 1, r, c, count); } } int main() { int r, c, count = 0; scanf("%d%d", &r, &c); compute(0, 0, r, c, &count); printf("%d", count + 1); }
Editor is loading...