Updated to work with the new libraries

This commit is contained in:
2021-07-03 02:38:00 -04:00
parent fd54eb90d8
commit 9660fe9287
82 changed files with 794 additions and 1008 deletions

View File

@@ -1,7 +1,7 @@
//ProjectEuler/ProjectEulerCPP/headers/Problems/Problem13.hpp
//Matthew Ellison
// Created: 09-29-18
//Modified: 08-28-20
//Modified: 07-02-21
//Work out the first ten digits of the sum of the following one-hundred 50-digit numbers
/*
37107287533902102798797998220837590246510135740250
@@ -110,7 +110,7 @@
//You can find more information about them at https://gmplib.org/
//When compiling this file you need to have the gmp library installed as well as linking the libraries to your executable using the -lgmpxx and -lgmp flags
/*
Copyright (C) 2020 Matthew Ellison
Copyright (C) 2021 Matthew Ellison
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -125,15 +125,13 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef PROBLEM13_HPP
#define PROBLEM13_HPP
#include <cinttypes>
#include <vector>
#include <string>
#include "gmpxx.h" //This is part of the gmp library
#include <gmpxx.h>
#include "Problem.hpp"
@@ -154,7 +152,7 @@ public:
virtual void solve(); //Solve the problem
virtual void reset(); //Reset the problem so it can be run again
//Gets
virtual std::string getResult(); //Return a string with the solution to the problem
virtual std::string getResult() const; //Return a string with the solution to the problem
std::vector<mpz_class> getNumbers() const; //Returns the list 50-digit numbers
mpz_class getSum() const; //Returns the sum of the 50-digit numbers
};
@@ -166,4 +164,5 @@ The first 10 digits of the sum of the numbers is 5537376230
It took an average of 13.270 microseconds to run this problem over 100 iterations
*/
#endif //PROBLEM13_HPP
#endif //PROBLEM13_HPP