hdu 6182 A Math Problem
程序员文章站
2022-03-24 15:47:19
...
快速幂开个long long即可,也可以暴力,因为数据小于10^18,即k<16
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
ll quic_power(ll x,ll n){ //快速幂
ll result=1;
for(;n;n>>=1){
if(n&1)
result*=x;
x*=x;
}
return result;
}
int main(){
ll n;
int cnt;
while(~scanf("%lld",&n)){
cnt=0;
for(int i=1;i<=15;i++)
if(quic_power(i,i)<=n)
cnt++;
printf("%d\n",cnt);
}
return 0;
}
下一篇: plt.subplots
推荐阅读
-
(string高精度)A + B Problem II hdu1002
-
Simple Math Problem
-
【线段树】【模板】讲解 + 例题1 HDU - 1754 I Hate It (点修改分数)+ 例题二 POJ - 3468 A Simple Problem with Integers(区间加值)
-
hdu 5371 Hotaru's problem (manacher)
-
HDU 6336 Problem E. Matrix from Arrays(找规律)
-
hdu 6336 Problem E. Matrix from Arrays
-
杭电第四场 hdu6336 Problem E. Matrix from Arrays 打表找规律 矩阵前缀和(模板)
-
HDU6336 Problem E. Matrix from Arrays
-
杭电多校04补题 HDU6336 Problem E. Matrix from Arrays【构造】
-
HDU 2256Problem of Precision(矩阵快速幂)