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.h> long jc(long a,long n); int main() { long b,n; cin>>b>>n; while(b!=0&&n!=0) { for(long a=0;a<=1000000;a++) { if(jc(a,n)>b) { if((b-jc(a-1,n))>(jc(a,n)-b)) { cout<<a<<endl; } else cout<<a-1<<endl; break; } } cin>>b>>n; } return 0; } long jc(long a,long n) { long sum=1; for(long i=0;i<n;i++) { sum=sum*a; } return sum; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator