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 350053879 at 2007-04-05 12:44:51 on Problem 1230
#include<iostream>
using namespace std;

typedef struct point{
        int x;
		int y;
}point;

point p[102];
point q[102];

int max(int i,int j)
{
	if(i>j)
		return i;
	else
		return j;
}
int min(int i,int j)
{
	if(i>j)
		return j;
	else
		return i;
}

int main()
{
	int testcase;
	int begin,end;
	int temp;
	int i,j,n,k;
	int Kmax[102];

	cin>>testcase;
	while(testcase--)
	{
		scanf("%d%d",&n,&k);
		for(i=0;i<=101;i++)
		{
			Kmax[i]=0;
		}

		for(i=0;i<n;i++)
		{
			scanf("%d%d%d%d",&p[i].x,&p[i].y,&q[i].x,&q[i].y);          
			
			begin=min(p[i].x,q[i].x);
			end=max(p[i].x,q[i].x);
			for(j=begin;j<=end;j++)
			{
				Kmax[j]++;
			}
			
		}

		temp=Kmax[0];

		for(i=0;i<=101;i++)
		{
			if(temp<Kmax[i]) temp=Kmax[i];
		}

		printf("%d\n",temp-k);
	}

	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