给定n求满足k^k < n的数的个数, 数据范围 n < 1e18, 应用快速幂.
#include <iostream>
using namespace std;
typedef long long LL;
LL qpow(LL x, LL n)
{
LL result = 1;
while(n) {
if(n & 1)
result = result*x;
n >>= 1;
x = x*x;
}
return result;
}
int main()
{
LL n;
while(cin >> n) {
LL i;
for(i = 1l; i <= 15l; i++)
if(qpow(i, i) > n)
break;
cout << i - 1 << endl;
}
return 0;
}