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

tle啊!

Posted by baichen at 2006-11-04 17:24:33 on Problem 3067
#include<stdio.h>
int a[1001][1001]={0};
main()
{
	int n,m,k,i,j,x,y,t,e=0;
	scanf("%d",&t);
	while(t--)
	{
		e++;
		int count=0;
		scanf("%d%d%d",&n,&m,&k);
		for(i=1;i<=n;i++)
			for(j=1;j<=m;j++)
				a[i][j]=0;
		while(k--)
		{
			scanf("%d%d",&x,&y);
			a[x][y]=1;
		}
		for(i=1;i<=n;i++)
			for(j=1;j<=m;j++)
				if(a[i][j]==1)
				{
					for(x=i+1;x<=n;x++)
						for(y=j-1;y>=0;y--)
							if(a[x][y]==1)
								count++;
				}
		printf("Test case %d: %d\n",e,count);
	}
	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