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

为什么总是Runtime Error??????????????????

Posted by BoLuoMi6996 at 2008-05-04 10:42:46
为什么在VC上能运行,测试结果也是正确的,submit后总是Runtime Error!
帮忙看一下吧。
#include<stdio.h>
int F(int a,int b);
int main(void)
{ 
	int a[20];
	char b[6];
	int j;
    int i=0;
	while(scanf("%s",b))
	{
	a[i]=atoi(b);
	i++;
	}
	for(j=0;j<i;j=j+2)
	{
	printf("%d %d %d\n",a[j],a[j+1],F(a[j],a[j+1]));
	}
   return 0;
}
int F(int a,int b)
{
	int s;
	int max=0;
	int t;
	for(a=a;a<=b;a++)
	{ 
		t=a;
		s=1;
	   while(t!=1)
	   {
		if(t%2==1)
		{
			t=3*t+1;
		}
		else
		{
			t=t/2;
		}
		s++;
	   }
	   if(s>max)
	   {max=s;}
	}
	
	return max ;
}

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