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:
@@ -34,6 +34,10 @@
|
||||
int Problem21::LIMIT = 10000; //The top number that will be evaluated
|
||||
|
||||
Problem21::Problem21() : Problem("Evaluate the sum of all the amicable numbers under 10000"){
|
||||
reserveVectors();
|
||||
}
|
||||
|
||||
void Problem21::reserveVectors(){
|
||||
divisorSum.reserve(LIMIT); //Reserving it now makes it faster later
|
||||
divisorSum.resize(LIMIT); //Make sure there are enough spaces
|
||||
}
|
||||
@@ -113,3 +117,10 @@ uint64_t Problem21::getSum() const{
|
||||
}
|
||||
return mee::getSum(amicable);
|
||||
}
|
||||
|
||||
void Problem21::reset(){
|
||||
Problem::reset();
|
||||
divisorSum.clear();
|
||||
amicable.clear();
|
||||
reserveVectors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user