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

怎么讨论得那么复杂?? 这题很简单吧?? 我的代码

Posted by ziliang at 2006-09-03 16:11:26 on Problem 2460
#include<stdio.h>
int x[200001];
int y[200001];
int main()
{
	int n;
	while(scanf("%d",&n),n){
		for(int i=0;i<n;i++)scanf("%d %d",&x[i],&y[i]);
		int a=0;
		int b=0;
		int xi=x[n/2];
		int yi=y[n/2];
		for(int i=0;i<n;i++){
			if(x[i]>xi && y[i]>yi || x[i]<xi && y[i]<yi){
				a++;
			}
			else if(x[i]>xi && y[i]<yi || x[i]<xi && y[i]>yi){
				b++;
			}
		}
		printf("%d %d\n",a,b);
	}
}


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