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

可以成功运行的,为何不对呢?

Posted by zhangquanwei at 2009-08-13 08:57:53 on Problem 3100
#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:
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