且未

博客园 首页 新随笔 联系 订阅 管理

题目

题意:给你两个整数 n 和 p ,让你求一个 k 满足 k^n=p,1<=n<= 200, 1<=p<10^101,1<=k<=10^9

类型          长度 (bit)           有效数字          绝对值范围
float             32                      6~7                  10^(-37) ~ 10^38
double          64                    15~16              10^(-307) ~10^308
long double   128                 18~19              10^(-4931) ~ 10 ^ 4932

1<=p<10^101,完全可以用double来存

#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
    double n,p;
    while(cin>>n>>p){
        cout<<pow(p,1/n)<<endl;
    }
    return 0;
}

 

posted on 2018-10-14 14:13  阿聊  阅读(86)  评论(0编辑  收藏  举报