-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1083.cpp
More file actions
38 lines (32 loc) · 836 Bytes
/
1083.cpp
File metadata and controls
38 lines (32 loc) · 836 Bytes
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
38
/*************************************************************************
> File Name: 1083.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2016年03月03日 星期四 17时15分33秒
************************************************************************/
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define LL long long
using namespace std;
const int N = 508;
int a[N][N] = {0};
int dp[N][N] = {0};
int main()
{
int n;
cin>>n;
memset(dp, 0, sizeof(dp));
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++) scanf("%d", &a[i][i]);
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
{
dp[i][j] = max(dp[i][j-1], dp[i-1][j]) + a[i][j];
cout<<dp[i][j]<<endl;
}
cout<<dp[n][n];
return 0;
}