Day 2
This commit is contained in:
parent
05becdbbbc
commit
cc2677ae2a
3 changed files with 2532 additions and 0 deletions
|
|
@ -10,3 +10,4 @@ if( NOT CMAKE_BUILD_TYPE )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(d1 "d1/main.cxx")
|
add_executable(d1 "d1/main.cxx")
|
||||||
|
add_executable(d2 "d2/main.cxx")
|
||||||
|
|
|
||||||
2500
d2/input.txt
Normal file
2500
d2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
31
d2/main.cxx
Normal file
31
d2/main.cxx
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::ifstream file{"../d2/input.txt"};
|
||||||
|
|
||||||
|
uint32_t tot{0};
|
||||||
|
uint8_t e, y;
|
||||||
|
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(file, line))
|
||||||
|
{
|
||||||
|
std::stringstream iss{line};
|
||||||
|
|
||||||
|
iss >> e >> y;
|
||||||
|
int es{(e % 65)}, ys{(y % 88)};
|
||||||
|
|
||||||
|
if (y == 'Z')
|
||||||
|
tot += 7 + ((es + 1) % 3);
|
||||||
|
else if (y == 'Y')
|
||||||
|
tot += 4 + es;
|
||||||
|
else
|
||||||
|
tot += 1 + ((es + 2) % 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << tot << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue