You are given a positive integer n, please count how many positive integers k satisfy
kk≤nkk≤n.
InputThere are no more than 50 test cases.
Each case only contains a positivse integer n in a line.
1≤n≤10181≤n≤1018
OutputFor each test case, output an integer indicates the number of positive integers k satisfy kk≤nkk≤n in a line.Sample Input
1 4Sample Output
1 2
题目大意:
输入一个n,输出一共有多少个k,满足pow(k,k)<=n;
(循环里的限制条件k<=n 不能用有,否则当n=1的时候就不能跳出循环了)
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long n;
while(~scanf("%lld",&n))
{
for(int k=1;;k++)
{
long long m=n;
for(int i=1;i<=k;++i) m /=k;
if(m==0)
{
cout<<k-1<<endl;
break;
}
}
}
return 0;
}