Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

数据都对,为什么是wrong answer

Posted by huxipeng at 2012-09-30 20:07:46 on Problem 3100
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator