题目链接:http://www.codeforces.com/problemset/problem/509/A
题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j-1],求f[n][n]。
C++代码:
#include <iostream> using namespace std; int n, f[11][11]; int main() { cin >> n; for (int i=1;i<=n;i++) f[i][1] = f[1][i] = 1; for (int i = 2; i <= n; i ++) for (int j = 2; j <= n; j ++) f[i][j] = f[i-1][j] + f[i][j-1]; cout << f[n][n]; return 0; }