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 |
wa了无数次,忍无可忍后只好枚举了#include<iostream> #include<cmath> using namespace std; int main() { double b,n; while(cin>>b>>n) { int i; if(b==0&&n==0) break; double temp=b; int record; for(i=1;pow(i,n)<=b+temp;i++) { if(abs(pow(i,n)-b)<temp) { temp=abs(pow(i,n)-b); record=i; } } cout<<record<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator