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 kuaichenyang at 2015-11-18 23:57:04 on Problem 2160
#include <stdio.h>
#include <stdlib.h>

typedef struct tagRec{
	int x,y;
}Rec;

int cmp(const void *a,const void *b){
	Rec *A=(Rec *)a;
	Rec *B=(Rec *)b;
	if(A->x!=B->x){
		return A->x-B->x;
	}
	return A->y-B->y;
}

int main(){
	int i;
	Rec rec[7];
	for(i=1;i<=6;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		if(x>y){
			int tmp=x;
			x=y;
			y=tmp;
		}
		rec[i].x=x;
		rec[i].y=y;
	}
	qsort(rec+1,6,sizeof(Rec),cmp);
	if(rec[1].x==rec[2].x&&rec[1].y==rec[2].y&&
		rec[3].x==rec[4].x&&rec[3].y==rec[4].y&&
		rec[5].x==rec[6].x&&rec[5].y==rec[6].y&&
		rec[1].x==rec[3].x&&rec[1].y==rec[5].x&&rec[3].y==rec[5].y){
			puts("POSSIBLE");
	}else{
		puts("IMPOSSIBLE");
	}
}

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