Add solution for 2015 Day 25
This commit is contained in:
1 parent
4de110a517
commit
9237445a13
6 files changed
+40
-12
No files matched your search
+17
-10
@@ -2,26 +2,33 @@
|
||||
|
||||
namespace y2015::day25
|
||||
{
|
||||
REGISTER_DAY(2015, Day25, std::vector<int>, int);
|
||||
using Pair = std::pair<int, int>;
|
||||
REGISTER_DAY(2015, Day25, Pair, int);
|
||||
|
||||
REGISTER_TEST_EXAMPLE(2015, Day25, ExampleInput, 1, 0);
|
||||
REGISTER_TEST(2015, Day25, Input, 1, 0);
|
||||
REGISTER_TEST_EXAMPLE(2015, Day25, ExampleInput, 1, 7981243);
|
||||
REGISTER_TEST(2015, Day25, Input, 1, 8997277);
|
||||
REGISTER_TEST_EXAMPLE(2015, Day25, ExampleInput, 2, 0);
|
||||
REGISTER_TEST(2015, Day25, Input, 2, 0);
|
||||
|
||||
READ_INPUT(input)
|
||||
{
|
||||
std::vector<int> vec;
|
||||
std::string str;
|
||||
while (getline(input, str))
|
||||
{
|
||||
}
|
||||
return vec;
|
||||
int i1;
|
||||
int i2;
|
||||
input >> "To continue, please consult the code grid in the manual. Enter the code at row " >> i2 >> ", column " >>
|
||||
i1;
|
||||
|
||||
return std::pair{i1, i2};
|
||||
}
|
||||
|
||||
int GetPower(const std::pair<int, int>& coordinate)
|
||||
{
|
||||
return (coordinate.first + coordinate.second - 1) * (coordinate.first + coordinate.second - 1 + 1) / 2 + 1 -
|
||||
coordinate.second;
|
||||
}
|
||||
|
||||
OUTPUT1(input)
|
||||
{
|
||||
return 0;
|
||||
return Helper::FastExponentiation(20151125, 252533, GetPower(input) - 1, 33554393);
|
||||
}
|
||||
|
||||
OUTPUT2(input)
|
||||
|
||||
Reference in new issue
Block a user