#include<bits/stdc++.h>
using namespace std;
using ldbl = long double;
using ll = long long;
const ldbl delta = 1e-9; const int N = 10; ll m[N], n[N], t[N];
namespace timer
{
typedef chrono::high_resolution_clock Clock_t;
typedef chrono::time_point<Clock_t> Time_t;
typedef chrono::microseconds Time_scale_t;
static Time_t present;
inline void reset()
{
present = Clock_t::now();
}
inline ll elapsed_time()
{
auto past = present; reset();
return chrono::duration_cast<Time_scale_t>(present-past).count();
}
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
n[0] = 1, timer::reset();
for(int j = 0; j < N; j++, n[j] = n[j-1]*10)
{
for(ldbl i_max = 1/ldbl(n[j]), i = 0; i <= i_max; i += delta)
m[j]++;
t[j] = timer::elapsed_time();
}
for(int j = 0; j < N; j++)
cout << j << ": n = " << n[j] << ", ",
cout << m[j] << " iteration(s), total loop execution-time = " << t[j] << " usec" << endl;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4gCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdXNpbmcgbGRibCA9IGxvbmcgZG91YmxlOwp1c2luZyBsbCAgID0gICBsb25nIGxvbmc7Cgpjb25zdCBsZGJsIGRlbHRhID0gMWUtOTsgY29uc3QgaW50IE4gPSAxMDsgbGwgbVtOXSwgbltOXSwgdFtOXTsgCgpuYW1lc3BhY2UgdGltZXIKewogICAgdHlwZWRlZiBjaHJvbm86OmhpZ2hfcmVzb2x1dGlvbl9jbG9jayAgICAgQ2xvY2tfdDsKICAgIHR5cGVkZWYgY2hyb25vOjp0aW1lX3BvaW50PENsb2NrX3Q+ICAgICAgICBUaW1lX3Q7CiAgICB0eXBlZGVmIGNocm9ubzo6bWljcm9zZWNvbmRzICAgICAgICAgIFRpbWVfc2NhbGVfdDsKIAogICAgc3RhdGljIFRpbWVfdCBwcmVzZW50OwogCiAgICBpbmxpbmUgdm9pZCByZXNldCgpCiAgICB7CiAgICAgICAgcHJlc2VudCA9IENsb2NrX3Q6Om5vdygpOwogICAgfQogCiAgICBpbmxpbmUgbGwgZWxhcHNlZF90aW1lKCkKICAgIHsKICAgICAgICBhdXRvIHBhc3QgPSBwcmVzZW50OyByZXNldCgpOwogCiAgICAgICAgcmV0dXJuIGNocm9ubzo6ZHVyYXRpb25fY2FzdDxUaW1lX3NjYWxlX3Q+KHByZXNlbnQtcGFzdCkuY291bnQoKTsKICAgIH0KfQoKaW50IG1haW4oKQp7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKSwgY2luLnRpZShudWxscHRyKSwgY291dC50aWUobnVsbHB0cik7IAogICAgCiAgICBuWzBdID0gMSwgdGltZXI6OnJlc2V0KCk7CiAgICAKICAgIGZvcihpbnQgaiA9IDA7IGogPCBOOyBqKyssIG5bal0gPSBuW2otMV0qMTApCiAgICB7CiAgICAgICAgZm9yKGxkYmwgaV9tYXggPSAxL2xkYmwobltqXSksIGkgPSAwOyBpIDw9IGlfbWF4OyBpICs9IGRlbHRhKQogICAgICAgICAgICBtW2pdKys7CiAgICAKICAgICAgICB0W2pdID0gdGltZXI6OmVsYXBzZWRfdGltZSgpOwogICAgfQogICAgCiAgICBmb3IoaW50IGogPSAwOyBqIDwgTjsgaisrKQogICAgICAgIGNvdXQgPDwgaiA8PCAiOiBuID0gIiA8PCBuW2pdIDw8ICIsICIsCiAgICAgICAgY291dCA8PCBtW2pdIDw8ICIgaXRlcmF0aW9uKHMpLCB0b3RhbCBsb29wIGV4ZWN1dGlvbi10aW1lID0gIiA8PCB0W2pdIDw8ICIgdXNlYyIgPDwgZW5kbDsKfQ==
0: n = 1, 1000000000 iteration(s), total loop execution-time = 1039169 usec
1: n = 10, 100000000 iteration(s), total loop execution-time = 104531 usec
2: n = 100, 10000001 iteration(s), total loop execution-time = 10602 usec
3: n = 1000, 1000000 iteration(s), total loop execution-time = 1053 usec
4: n = 10000, 100000 iteration(s), total loop execution-time = 107 usec
5: n = 100000, 10001 iteration(s), total loop execution-time = 10 usec
6: n = 1000000, 1000 iteration(s), total loop execution-time = 1 usec
7: n = 10000000, 100 iteration(s), total loop execution-time = 0 usec
8: n = 100000000, 10 iteration(s), total loop execution-time = 0 usec
9: n = 1000000000, 1 iteration(s), total loop execution-time = 0 usec