http://train.usaco.org/usacoprob2?a=Svf4STUJArF&S=numtri
经典数塔问题
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
//动态归化
int a[1005][1005];
int main()
{
ifstream fin("numtri.in");
ofstream fout("numtri.out");
int n;
fin >> n;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= i; j++)
fin >> a[i][j];
for(int i = n; i >= 1; i--)
for(int j = 1; j <= i; j++)
a[i][j] += a[i + 1][j] > a[i + 1][j + 1] ? a[i + 1][j] : a[i + 1][j + 1];
fout << a[1][1] << endl;
fout.close();
return 0;
}