-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchallenge.hpp
More file actions
81 lines (60 loc) · 1.97 KB
/
challenge.hpp
File metadata and controls
81 lines (60 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// challenge.hpp
// Challenges
//
// Created by Carlos Álvaro on 25/03/2021.
// Copyright © 2021 cdalvaro. All rights reserved.
//
#ifndef challenges_c0019_challenge_hpp
#define challenges_c0019_challenge_hpp
#include <chrono>
#include <ctime>
#include "challenges/ichallenge.hpp"
namespace challenges {
/**
@class Challenge19
@brief This class is intended to solve Challenge 19
@link https://projecteuler.net/problem=19 @endlink
*/
class Challenge19 : virtual public IChallenge {
public:
//! @copydoc IChallenge::Type_t
using Type_t = std::size_t;
/**
@brief Class constructor
@param first_year Initial year
@param last_year Last year
This is the main constructor of Challenge19 class
*/
Challenge19(const int &first_year, const int &last_year);
/**
@brief Default destructor
*/
~Challenge19() override = default;
/**
This method contains the algorithm that solves challenge 19
@return The solution for challenge 19
*/
Solution_t solve() final;
private:
using Clock_t = std::chrono::system_clock;
using Date_t = std::chrono::time_point<Clock_t>;
int first_year; ///< Initial year
int last_year; ///< Last year
/**
Create a \c Date_t object from integers
@param year The year
@param month The month
@param day The day
@return A \c Date_t object for the given values
*/
static Date_t dateFor(const int &year, const int &month, const int &day);
/**
Create a \c std::tm object from a \c Date_t object
@param date The \c Date_t object to be converted
@return The \c std::tm object corresponding to the \p date parameter
*/
static std::tm tmFrom(const Date_t &date);
};
} // namespace challenges
#endif /* challenges_c0019_challenge_hpp */