Added solution to problem 31

This commit is contained in:
2020-06-19 19:57:59 -04:00
parent b74622351e
commit a7d960c3b1
5 changed files with 175 additions and 34 deletions

52
Headers/Problem31.hpp Normal file
View File

@@ -0,0 +1,52 @@
//ProjectEuler/C++/Headers/Problem31.hpp
//Matthew Ellison
// Created: 06-19-20
//Modified: 06-19-20
//How many different ways can £2 be made using any number of coins?
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses
/*
Copyright (C) 2020 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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
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 PROBLEM31_HPP
#define PROBLEM31_HPP
#include <string>
#include <vector>
#include "Problem.hpp"
class Problem31 : public Problem{
private:
static int desiredValue;
int permutations;
public:
Problem31();
virtual void solve();
virtual std::string getString() const;
//Returns the number of correct permutations of the coins
int getPermutations() const;
};
/* Results:
There are 73682 ways to make 2 pounds with the given denominations of coins
It took 0.000 nanoseconds to solve this problem.
*/
#endif //PROBLEM31_HPP