Easy one tussendoor met hulp van Miekster
This commit is contained in:
33
063/main.cpp
Normal file
33
063/main.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
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::milliseconds>(chrono::high_resolution_clock::now() - start);
|
||||||
|
cout << (float)duration.count()/1000 << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -18,3 +18,4 @@ add_executable(base base.cpp)
|
|||||||
add_executable(euler059 059/main.cpp)
|
add_executable(euler059 059/main.cpp)
|
||||||
add_executable(euler060 060/main.cpp)
|
add_executable(euler060 060/main.cpp)
|
||||||
add_executable(euler061 061/main.cpp)
|
add_executable(euler061 061/main.cpp)
|
||||||
|
add_executable(euler063 063/main.cpp)
|
||||||
|
|||||||
Reference in New Issue
Block a user