int minimumTotal(int** triangle, int triangleSize, int* triangleColSize)
{
int f[triangleSize][triangleSize];
memset(f,0,sizeof(f));
f[0][0]=triangle[0][0];
for(int i=1;i<triangleSize;i++)
{
f[i][0]=f[i-1][0]+triangle[i][0]; //左侧的边界条件,j只能为0
for(int j=1;j<i;j++)
{
f[i][j]=fmin(f[i-1][j],f[i-1][j-1])+triangle[i][j];
}
f[i][i]=f[i-1][i-1]+triangle[i][i]; //右侧的边界条件,j必须和i同步减一
}
int res=f[triangleSize-1][0];
for(int i=1;i< triangleSize;i++)
{
res=fmin(res,f[triangleSize - 1][i]);
}
return res;
}