PersonalCorpus 版 (精华区)
1044228 Big Guava ... 496 Accepted 0:00.000
64 2002/08/27 05:41:54.043
void main()
{
int a[10000],b[10000];
bool mb[10000];
int i,j,k,la,lb;
bool A,B,AB,ok;
char s[50000];
while (gets(s)!=NULL) {
i=0; la=0;
while (s[i]!=0) {
sscanf(s+i,"%d",&a[la++]);
while (isdigit(s[i])) i++;
while ((!isdigit(s[i]))&&(s[i]>0)) i++;
}
gets(s);
i=0; lb=0;
while (s[i]!=0) {
sscanf(s+i,"%d",&b[lb++]);
while (isdigit(s[i])) i++;
while ((!isdigit(s[i]))&&(s[i]>0)) i++;
}
A=false;
B=false;
AB=false;
memset(mb,255,sizeof(mb));
for (i=0;i<la;i++) {
for (j=0;j<i;j++) if (a[i]==a[j]) break;
if (j<i) continue;
ok=true;
for (j=0;j<lb;j++) if ((mb[j])&&(a[i]==b[j])) {
mb[j]=false;
AB=true;
ok=false;
}
if (ok) A=true;
}
for (i=0;i<lb;i++) if (mb[i]) { B=true; break; }
if (!AB) printf("A and B are disjoint\n");
else if (A&&B) printf("I'm confused!\n");
else if ((!A)&&(!B)) printf("A equals B\n");
else if (A) printf("B is a proper subset of A\n");
else printf("A is a proper subset of B\n");
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.878毫秒