codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

时间:2024-01-06 11:53:26

题目链接: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[][];
int main()
{
cin >> n;
for (int i=;i<=n;i++)
f[i][] = f[][i] = ;
for (int i = ; i <= n; i ++)
for (int j = ; j <= n; j ++)
f[i][j] = f[i-][j] + f[i][j-];
cout << f[n][n];
return ;
}

C++