Lang:GCC
Edit1234567891011121314#include <stdio.h>int n,map[201][201],f[201][201];int max_(int a,int b) {return a>b?a:b;}int main(){int i,j;scanf("%d",&n);for (i=1;i<=n;i++)for (j=1;j<=i;j++) scanf("%d",&map[i][j]);for (i=1;i<=n;i++) f[n][i]=map[n][i];for (i=n-1;i>=1;i--)for (j=1;j<=i;j++) f[i][j]=max_(f[i+1][j],f[i+1][j+1])+map[i][j];printf("%d\n",f[1][1]);return 0;}