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 xiongyan at 2007-10-05 23:56:09 on Problem 1730
#include<stdio.h>
#include<math.h>
double x;
int main(void)
{
    scanf("%lf",&x);
    while(x)
    {
        int i;
        int flag=0;
        int max=0;
        if(x<0)
        {
            x=-x;
            flag=1;
        }
        int shangjie=sqrt(x);
        if(flag==0)
        {
            for(i=1;i<=shangjie;i++)
            {
                double linshi;
                int h;
                linshi=pow(x,1/(double)i);
                h=(int)(linshi+1e-12);
                if(linshi+1e-12>h&&linshi-1e-12<h)
                {
                    if(i>max)
                        max=i;
                }
            }
        }
        else
        {
            for(i=1;i<=shangjie;i=i+2)
            {
                double linshi;
                int h;
                linshi=pow(x,1/(double)i);
                h=(int)(linshi+1e-12);
                if(linshi+1e-12>h&&linshi-1e-12<h)
                {
                    if(i>max)
                        max=i;
                }
            }
        }
        printf("%d\n",max);
        scanf("%lf",&x);
    }
    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