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

Re:这样为什么就WA呢?哪位大牛给看看,谢了?

Posted by kirsten0302 at 2009-08-04 12:14:11 on Problem 3100
In Reply To:这样为什么就WA呢?哪位大牛给看看,谢了? Posted by:Eli_love at 2009-06-07 14:02:25
俄,想法很简单阿
#include <iostream>
#include <cmath>
using namespace std;

int main ()
{
	int a,b,n,i;
	while (scanf("%d%d",&b,&n)!=EOF&&(b!=0&&n!=0))
	{
		for (i=1;i<=b;i++)
		{
			if ((int)pow(double(i),n)>b) break;
			else continue;
		}
		if ((int)pow(double(i-1),n)==b) {cout<<i-1<<endl;continue;}
		if ((int)pow(double(i),n)-b>(b-(int)pow(double(i-1),n)))
		{cout<<i-1<<endl;continue;} else {cout<<i<<endl;continue;}
		
	}
	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