#include using namespace std; const int DEPTH = 100; int main(){ cout << "Hello this is Patrick" << endl; auto start = chrono::high_resolution_clock::now(); int c; ifstream triangleFile("../txts/p067_triangle.txt"); vector> triangle(DEPTH); for(int i = 0; i < DEPTH; ++i){ for(int j = 0; j <= i; ++j){ triangleFile >> c; triangle[i].push_back(c); } } // Checking if it reads correctly, which it did on the first try yey // for(auto row : triangle){ // for(auto n : row){ // cout << n << " "; // } // cout << endl; // } vector> maxima(DEPTH); maxima[DEPTH - 1] = triangle[DEPTH - 1]; for(int i = DEPTH - 2; i >= 0; --i){ for(int j = 0; j <= i; ++j){ maxima[i].push_back(max(maxima[i + 1][j], maxima[i + 1][j + 1]) + triangle[i][j]); } } cout << maxima[0][0] << endl; auto duration = chrono::duration_cast(chrono::high_resolution_clock::now() - start); cout << (float)duration.count()/1000 << endl; return 0; }