hiho Week 5 register

Ended

Participants:445

Verdict:Accepted
Score:100 / 100
Submitted:2014-08-06 21:29:09

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <cstdio>
#include <algorithm>
using namespace std;
int award[100][100];
int main(void)
{
    //
    int n, i, j;
    scanf("%d", &n);
    for (i = 0; i < n; ++i)
        for (j = 0; j <= i ; ++j)
            scanf("%d\n", &award[i][j]);
    n -= 2;
    while(n >= 0)
    {
        for (i = 0; i <= n; ++i)
            award[n][i] += max(award[n+1][i], award[n+1][i+1]);
        --n;
    }
    printf("%d\n",award[0][0]);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX