Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
数据有问题的,这个代码示例过不了,但能ac#include<stdio.h> #include<math.h> #include<stdlib.h> #include<iostream> #include<algorithm> #include<cmath> using namespace std; int main() { long long left,right,mid; double n,p; while(cin>>n>>p) { left=0;right=1000000; while(right-0.00001>left) { mid=(left+right)/2; if(pow(mid,n)-p>0) { right=mid; } else if(pow(mid,n)-p<0) { left=mid; } else { printf("%.0lld\n",mid); break; } } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator