Files
contests/projecteuler/063/main.cpp

34 lines
790 B
C++

#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;
}