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 |
可以成功运行的,为何不对呢?#include<iostream> #include<math> using namespace std; int main() { int b,n; int a; cin>>b>>n; while(b!=0 && n!=0) { for(a=1;a<=b;a++) { if(abs(b-pow(a,n))<=abs(b-pow(a+1,n)) && abs(b-pow(a,n))<=abs(b-pow(a-1,n))) { cout<<a<<endl; break; } } cin>>b>>n; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator