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

我找不到哪个测试结果使我的程序出错,老是WA,哪个高手能指点一下吗?

Posted by 327719498 at 2007-11-10 16:03:59 on Problem 3100
#include<stdio.h>
#include<stdlib.h>
long int jiecheng(long int m,long int n)
{
    long int i,s=n;
    for(i=1;i<m;i++)
      s=s*n;
    return s;
}
int main()
{
    long int b,n,m,i,k,min;
    do 
    {
      min=10000000;
      scanf("%ld%ld",&b,&n);
      for(i=0;;i++)
      {
         m=jiecheng(n,i);
         k=abs(m-b);
         if(min>=k)
           min=k;
         else
           break;
      }
      printf("%ld\n",i-1);
    }while(b!=0&&n!=0);
    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