标签:des style blog http color os strong io
Description
Input
Output
Sample Input
Sample Output
#include <stdio.h>
#include <string.h>
char s[10000][20], e;
int flag[10000];
int main()
{
int t;
int i, j;
char s1[20], s2[20];
int cnt;
while(scanf("%d", &t)!=EOF)
{
if(t==0)
break;
e = 0;
for(i=0; i<10000; i++)
{
flag[i] = -1;
}
for(i=0; i<t; i++)
{
scanf("%s %s", s1, s2 );
for(j=0; j<e; j++)
{
if(strcmp(s[j], s1)==0)//之前出现过了
{
break;
}
}
if(j==e)
{
strcpy(s[e++], s1 );
flag[e-1] = 0;
}
for(j=0; j<e; j++)
{
if(strcmp(s[j], s2)==0)
{
flag[j] += 1; //被打败
break;
}
}
if(j==e)
{
strcpy(s[e++], s2);
flag[e-1] = 1;
}
}
cnt=0;
for(i=0; i<e; i++)
{
if(flag[i]==0)
{
cnt++;
}
}
if(cnt==1)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
标签:des style blog http color os strong io
原文地址:http://www.cnblogs.com/yspworld/p/3884870.html