Easy one tussendoor met hulp van Miekster

This commit is contained in:
2021-05-15 00:23:57 +02:00
parent 1879be093d
commit 1aa6120838
2 changed files with 34 additions and 0 deletions

33
063/main.cpp Normal file
View 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;
}