| ||||||||||
| 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 | |||||||||
数据都对,为什么是wrong answer#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,n,c;
int m;
while(cin>>a>>b&&a!=0,b!=0){
n=pow(a,1.0/b);
c=int(n);
n=abs(c);
m=abs(c+1);
n=pow(n,b);
m=pow(m,b);
n=abs(n-a);
m=abs(m-a);
if(n<m)
cout<<c<<endl;
else
cout<<c+1<<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