mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Added a benchmark tool
This commit is contained in:
@@ -237,15 +237,6 @@ std::vector<int> Problem67::list[NUM_ROWS] = {
|
||||
};
|
||||
|
||||
Problem67::Problem67() : Problem("Find the maximum total from the top to the bottom of the pyramid."){
|
||||
//The method that I am using looks for the smallest numbers, so I need to invert the numbers in this list
|
||||
invert();
|
||||
//Now l[i][j] == 100 - l[i][j];
|
||||
|
||||
//Add the top point because that is already the only path
|
||||
foundPoints.emplace_back(0, 0, list[0][0], false);
|
||||
//Add the second row as possible points
|
||||
possiblePoints.emplace_back(0, 1, (list[0][0] + list[1][0]), true);
|
||||
possiblePoints.emplace_back(1, 1, list[0][0] + list[1][1], false);
|
||||
}
|
||||
|
||||
void Problem67::invert(){
|
||||
@@ -265,6 +256,16 @@ void Problem67::solve(){
|
||||
//Start the timer
|
||||
timer.start();
|
||||
|
||||
//The method that I am using looks for the smallest numbers, so I need to invert the numbers in this list
|
||||
invert();
|
||||
//Now l[i][j] == 100 - l[i][j];
|
||||
|
||||
//Add the top point because that is already the only path
|
||||
foundPoints.emplace_back(0, 0, list[0][0], false);
|
||||
//Add the second row as possible points
|
||||
possiblePoints.emplace_back(0, 1, (list[0][0] + list[1][0]), true);
|
||||
possiblePoints.emplace_back(1, 1, list[0][0] + list[1][1], false);
|
||||
|
||||
bool foundBottom = false; //Used when you find a point at the bottom
|
||||
|
||||
//Loop until you find the bottom
|
||||
@@ -402,4 +403,12 @@ int Problem67::getTotal() const{
|
||||
throw unsolved();
|
||||
}
|
||||
return actualTotal;
|
||||
}
|
||||
}
|
||||
|
||||
//Clears all of the variables so the problem can be run again
|
||||
void Problem67::reset(){
|
||||
Problem::reset();
|
||||
foundPoints.clear();
|
||||
possiblePoints.clear();
|
||||
actualTotal = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user