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 Muye007 at 2013-10-03 04:36:52 on Problem 3100
In Reply To:硬开根号,然后判断相邻的的两个整数哪个的n次方离b最近。 Posted by:lulyon at 2011-03-14 00:44:20
#include <stdio.h>
#include <math.h>
int main()
{
    int a,b;
    double c;
    while(scanf("%d%d",&a,&b)&&a!=0)
    {
        c=pow(a,1.0/b);
        if(a-pow((int)c,b)<pow((int)(c+1),b)-a) printf("%d\n",(int)c);
        else printf("%d\n",(int)c+1);
    }
    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