被数据给吓到了,本来以为是各种高精度的综合题,又想是否是高深的数学结论题,怎么做出来的人这么多啊。。。看reader的时候同学的BOLG有,发现原来是double 就可以搞,无语。。。。连精度都不卡。。。
1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <math.h> 5 #define N 1000000000 6 int main() 7 { 8 int n; 9 double p,s,str,end; 10 while(scanf("%d%lf",&n,&p)!=EOF) 11 { 12 str = 1; 13 end = N; 14 while(str < end) 15 { 16 s = pow((str+end)/2,n); 17 if(s < p) 18 { 19 str = (str+end)/2; 20 } 21 else if(s == p) 22 { 23 break; 24 } 25 else 26 { 27 end = (str+end)/2; 28 } 29 } 30 printf("%.0lf\n",str); 31 } 32 return 0; 33 }