Skip to content

Commit 4027a91

Browse files
committed
Maximum in Table
1 parent 8b90cf9 commit 4027a91

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

509A.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
5+
#define ll long long
6+
#define endl '\n'
7+
#define debug(n) cout<<(n)<<endl;
8+
const ll INF = 2e18 + 99;
9+
10+
int main(){
11+
ios_base::sync_with_stdio(false);
12+
cin.tie(NULL);
13+
14+
int n;
15+
cin>>n;
16+
17+
int a[n][n];
18+
19+
for(int i = 0; i < n; i++){
20+
for(int j = 0; j < n; j++){
21+
if(i == 0 || j == 0){
22+
a[i][j] = 1;
23+
}
24+
else{
25+
a[i][j] = a[i-1][j] + a[i][j-1];
26+
}
27+
}
28+
}
29+
cout<<a[n-1][n-1];
30+
}

0 commit comments

Comments
 (0)