「CF509A」Maximum in Table
题解
直接得出矩阵T T
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<set> #include<ctime> #include<vector> #include<queue> #include<algorithm> #include<map> #include<cmath> #define inf 1000000000 #define rad 100000000 #define pa pair<int,int> #define ll long long using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n; int a[15][15]; int main() { n=read(); for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { if(i==1||j==1)a[i][j]=1; else a[i][j]=a[i][j-1]+a[i-1][j]; } printf("%d\n",a[n][n]); return 0; } |
Subscribe