Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请教牛人,不知道是不是想法不对。我的想法是打牌的人每种牌有且只有一张,没有顺序关系。判断是不是能够把其他两人的消掉。判断条件是在配对的牌间连线,看有没有相交的. 有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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator