luogu7 月份月赛 1 题目题解:

#include<bits/stdc++.h>
using namespace std;
inline long long read(){
     long long ans=0;
     char last=' ',ch=getchar();
     while(ch<'0' || ch>'9')last=ch,ch=getchar();
     while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
     if(last=='-')ans=-ans;
     return ans;
}
//快读
double ans(int a,int b){
    return (double)exp(log(a)/b);
}
//取根
int main(){
    long long n=read();
    long long m=read();
    long long c=0,i=0;
    if(m==1){
        cout<<n;return 0;
    }
    double a=ans(n,m);
    cout<<floor(a);
}

思路:观察题目,你会发现答案就是pow(n,1/m).

5 1 vote
Article Rating
Subscribe
提醒
2 评论
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
qyh

https://ericnth.cn/qinyihao/article/2393/
您这篇可以退休了。。。。。。。。

EricNTH

哈哈哈是撞车了吗。

2
0
Would love your thoughts, please comment.x
()
x