Euler 1-5

This commit is contained in:
Jos van Goor 2022-12-01 16:45:37 +01:00
parent 9cf858b860
commit 68a75987e2
6 changed files with 161 additions and 0 deletions

19
project_euler/problem4.cc Normal file
View file

@ -0,0 +1,19 @@
#include <cstdint>
#include <fmt/format.h>
int main()
{
std::uint64_t max = 0;
for (std::size_t a = 999; a > 99; a--)
{
for (std::size_t b = 999; b > 99; b--)
{
std::string number = std::to_string(a * b);
if (std::equal(number.begin(), number.end(), number.rbegin()))
max = std::max(max, a * b);
}
}
fmt::print("Result: {}\n", max);
}