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() { int b,n,i,min1=1; double cha[20],min,sun[20]; while(cin>>b>>n) { if(b==0&&n==0) break; for(i=1;i<=16;i++) { sun[i]= pow(double (i),double (n)); cha[i]=abs(sun[i]-b); } min=cha[1]; for(i=2;i<=16;i++) if(cha[i]<min) { min=cha[i];min1=i;} cout<<min1<<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