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 1120101767 at 2011-09-05 13:52:18 on Problem 3100
#include "stdio.h"
#include "stdlib.h"
int main()
{ int find(long b,int n);
int i,b[200]={0},n[200]={0},pr;
 i=0;
 do
 { 
  scanf("%d",&b[i]);
  scanf("%d",&n[i]);
  i++;}while((b[i-1]!=0)&&(n[i-1]!=0)&&(b[i]>=1)&&(b[i]<=1000000)&&(n[i]>=1)&&(n[i]<=9));

  for(i=0;((b[i]!=0)&&(n[i]!=0));i++)
{ pr=find(b[i],n[i]);
  printf("%d\n",pr);}
  return 0;
system("pause");
}
int find(long b,int n)
{ int numa,i;
   long   end,diff,min=1000000;
  int a_n(int a,int n);
      
	 for(numa=1;numa<b;numa++)  
	{  end=1;
		for(i=0;i<n;i++)
	 { end=end*numa;}
      diff=end-b;
	    {
		if(diff<0)
		 diff=diff*(-1);}         
        if(diff<min)
	      min=diff;
		if(diff>=min)
		return(numa-1);
    
}
}

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