View Code of Problem 610

#include<stdio.h>
int dp[11][11];
int main() {
	int n,i,j;
	while(scanf("%d", &n)!=EOF){
		for(i = 0; i <=n;i ++){
			for(j = 0; j <= n; j++){
				if(i == 0){
					dp[i][j] = 0;
					continue;
				}
				if( j == 0){
					dp[i][j] = 1;
					continue;
				}
				if(i < j){
					dp[i][j] = 0;
					continue;
				}
				dp[i][j] = dp[i-1][j]+dp[i][j-1];
			}
		}
		printf("%d\n", dp[n][n]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 610