注意:
再次复习一下C++的基础
类型 长度 有效数字 绝对值范围
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
有人用 二分加高精度 ,有空试一试http://hi.baidu.com/whuwinnie/blog/item/89015ccc8c37601600e928b7.html
#include<iostream>
#include<cstdio>#include<cmath>
int main()
{
double p,n;
while(scanf("%lf %lf",&n,&p)!=EOF)
{
double ans=pow(p,1.0/n);
printf("%.0lf\n",ans);//²»ÄÜд³É£¨"%d\n",ans£©
}
return 0;
}
/*
#include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
const double eps=1e-6;
int main()
{
double n,p;
while(scanf("%lf %lf",&n,&p)!=EOF)
{
double ans=pow(p+eps,1.0/n);
printf("%.0lf\n",ans);
}
return 0;
}*/