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

用GCC提交2015MS 44K 用C提交578MS 28K。。。

Posted by eulerray at 2007-06-02 16:01:55 on Problem 2941
WHY?
#include<stdio.h>

void main()
{
	int n,flag,i,j,k;
    long a[1002],b[1002],s;
	while( scanf("%d",&n)!=EOF){

		if(n==0)
			break;
		flag=1;
		for(i=1;i<=n;i++)
			scanf("%ld",&a[i]);
		
		for(i=1;i<n;i++)
			b[i]=a[i+1]-a[i];
		
		for(j=2;j<=n;j++){
			for(i=1;i<=n;i++)
				scanf("%ld",&a[i]);
			for(i=1;i<n;i++)
				if(b[i]!=a[i+1]-a[i]){
					flag=0;
					goto mm;
				}
		}
 mm: {
		for(k=j+1;k<=n;k++)
			for(i=1;i<=n;i++)
				scanf("%ld",&s);
	 }
			
			
	if(flag==1)
		printf("homogeneous\n");
	if(flag==0)
		printf("not homogeneous\n");
	} 


}

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