int minimumTotal(vector<vector<int>>& triangle) { //using DP from down to top int n = triangle.size(); //the original value of the bottom row vector<int> minLen(triangle.back()); for(int i=n-2; i>=0; i--){ for(int j=0; j<=i; j++){ minLen[j] = min(minLen[j],minLen[j+1])+triangle[i][j]; } } return minLen[0]; }
void Foam::polyMeshFilterSettings::writeSettings(Ostream& os) const { os << "Merging:" << nl << " edges with length less than " << minLen() << " metres" << nl << " edges split by a point with edges in line to within " << radToDeg(::acos(maxCos())) << " degrees" << nl << " Minimum edge length reduction factor = " << edgeReductionFactor() << nl << endl; if (collapseFacesCoeffDict().empty()) { os << "Face collapsing is off" << endl; } else { os << "Face collapsing is on" << endl; os << " Initial face length factor = "<< initialFaceLengthFactor() << endl; } os << "Control mesh quality = " << controlMeshQuality().asText() << endl; if (controlMeshQuality()) { os << " Minimum edge length reduction factor = " << edgeReductionFactor() << nl << " Minimum face area reduction factor = " << faceReductionFactor() << endl; os << " Maximum number of collapse iterations = " << maxIterations() << endl; os << " Maximum number of edge/face reduction factor smoothing " << "iterations = " << maxSmoothIters() << endl; os << " Maximum number of times a point can contribute to bad " << "faces across " << nl << " collapse iterations = " << maxPointErrorCount() << endl; } os << "Selectively disabling wanted collapses until resulting quality" << " satisfies constraints in system/meshQualityDict" << nl << endl; }