| ||||||||||
| 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 | |||||||||
Re:这样为什么就WA呢?哪位大牛给看看,谢了?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator