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

why wrong answer, plz guys help, it passed all the samples i know

Posted by hasan83 at 2007-09-22 23:13:55 on Problem 1730
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
    double b;
    int n,i,k,x;
    __int64 temp;
    while(cin>>n&&n!=0)
    {              
        if(n<0)x=2,n=abs(n);else x=1;
        k=0;
        for(temp=1;temp<n;temp*=2)k++;
        if(x==2&&k%2==0)k-=1;
        for(i=k;i>=1;i-=x)
        {
            b=pow(n,double(1)/i);             
            if(int(b)==b)break;
            double dn=double(n);
            double dr=pow(double(int(b+0.5)),double(i));
            if(dr==dn)break;              
        }  
        cout<<i<<endl;             
    }
    
    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