diff --git a/063/main.cpp b/063/main.cpp new file mode 100644 index 0000000..3a50b36 --- /dev/null +++ b/063/main.cpp @@ -0,0 +1,33 @@ +#include +#include +#include + +using namespace std; + +uint intlength(long double i){ + return floor(log10(i)) + 1; +} + +int main(){ + + cout << "Hello this is Patrick" << endl; + auto start = chrono::high_resolution_clock::now(); + + int result = 0; + + for(uint i = 1; i < 10; ++i){ + for(uint j = 1; j <= 10000; ++j){ + long double exp = pow(i, j); + if(intlength(exp) == j){ + result++; + cout << i << " " << j << " " << exp << endl; + } + } + } + + cout << result << endl; + + auto duration = chrono::duration_cast(chrono::high_resolution_clock::now() - start); + cout << (float)duration.count()/1000 << endl; + return 0; +} diff --git a/CMakeLists.txt b/CMakeLists.txt index ebc4f32..8e5645e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,3 +18,4 @@ add_executable(base base.cpp) add_executable(euler059 059/main.cpp) add_executable(euler060 060/main.cpp) add_executable(euler061 061/main.cpp) +add_executable(euler063 063/main.cpp)