-29. From One Corner to Another

 avatar
user_6817964
c_cpp
a year ago
432 B
2
Indexable
Never
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);
}