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 qiqi0120 at 2007-05-19 12:20:36 on Problem 2769
#include "iostream"
using namespace std;

long Mod(long Arr[],long Len)
{
	long Mod = 1;
	long count = 0;
	long Mod_Stroe[300];
	for (int k = 0; k < 300;k++)
	{
		Mod_Stroe[k] = -1;
	}	
	if (Len == 1)
	{
		return 1;
	}
	else
	{
		for (long i = Len;;i++)
		{
			Mod = i;
			for (long j = 0;j < Len;j++)
			{
				if (Mod_Stroe[Arr[j] % Mod] != -1) 
				{
					break;
				}
				else
				{
					Mod_Stroe[Arr[j] % Mod] = Arr[j] % Mod;
					count++;
				}				
			}
			if (count == Len)
			{
				return Mod;
			}
			for (long k = 0; k < 300;k++)
			{
				Mod_Stroe[k] = -1;
			}	
			count = 0;
		}
	}
}
int main(void)
{
	long Num;
	long Case_Num;
	long Store[300];
	cin>>Num;
	//long *Result = new unsigned long[Num];
	for (long i = 0; i < Num; i++)
	{
		cin>>Case_Num;
		for (long j = 0;j < Case_Num; j++)
		{
			cin>>Store[j];
		}
		cout<<Mod(Store,Case_Num)<<'\n';
		//Result[i] = Mod(Store,Case_Num);
	}
	/*for (i = 0; i < Num; i++)
	{
		cout<<Result[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