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 wr at 2005-10-05 16:56:50 on Problem 1999
我的想法是打牌的人每种牌有且只有一张,没有顺序关系。判断是不是能够把其他两人的消掉。判断条件是在配对的牌间连线,看有没有相交的.
有AC的懒得说就把code站内发一下,谢了。

#include <stdio.h>
#include <string.h>
#define max 100008
long a[max],b[max];
char pk[max*10]; 
int main(){
	long z,i,m,n,p,l;
	for (scanf("%ld",&z);z>0;z--) {
		for (i=1;i<=10*max;i++) pk[i]=0;
		scanf("%ld%ld",&m,&n);  p=1; l=-1;
		for (i=1;i<=m;i++) { 
			scanf("%ld",&a[i]);	if (a[i]>=10*max)for (;;);
			pk[a[i]]=1; 
		}
		for (i=1;i<=n;i++) {
			scanf("%ld",&b[i]);	
			if (p&&b[i]<10*max&&pk[b[i]]==1) {
				if (l==-1||b[i]>l) l=b[i];
				else p=0;
			}
		}
		if (p==1) printf("Hrac ma sanci vyhrat.\n");
		else printf("Spatne usporadani.\n");
	}
	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