CCC(Canadian Computing Competition)s task.

This problem is level three (a good grade 12 student MIGHT get this)

I used typical DP(Dynamic Programming) to solve this problem.

#include <bits/stdc++.h>
using namespace std;

int dp[30][30];
int r,c,k;
bool ch[30][30];
int main(){
	scanf("%d%d%d",&r,&c,&k);

	for(int i = 1;i <= r;i++){
		for(int j = 1;j <= c;j++){
			ch[i][j] = false;
		}
	}

	for(int i = 0;i < k;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		ch[a][b] = true;
	}
	dp[1][1] = 1;
	for(int i = 1;i <= r;i++){
		for(int j = 1;j <= c;j++){
			if(ch[i][j] == true)continue;
			dp[i][j] += dp[i-1][j] + dp[i][j-1];
		}
	}
	printf("%d
",dp[r][c]);
	return 0;
}