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 wa

Posted by gothree at 2009-04-08 11:29:29 on Problem 2769
#include <stdio.h>

int main ()
{
	int testCase = 0;
	int num = 0;
	int i = 0, j = 0, k = 0;
	int differ[89704];
	int sin[320];

	scanf ("%d", &testCase);

	while (testCase--)
	{
		scanf ("%d", &num);

		for (i = 0; i < num; i++)
			scanf ("%d", &sin[i]);

		/*if (num==1)
		{
			printf ("1\n");
			continue;
		}*/

		k = 0;
		for (i = 0; i < num; i++)
			for (j = i+1; j < num; j++)
			{
				differ[k] = sin[i] - sin[j];
				if (differ[k] < 0)
					differ[k] = 0 - differ[k];
				k ++;
			}

		j = num;
		for (i = 0; i < k; i ++)
		{
			while (differ[i] % j == 0)
				j ++;
		}

		printf ("%d\n", j);
	}

	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