1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <stdlib.h> #include <strin int () { freopen("Sample Input.txt","r",stdin); system("Color F0"); char s[100]; int i,j,k,len; int m[30][30]; while (gets(s)) { memset(m,0,sizeof(m)); while (s[0]!='0') { len = strlen(s); m[s[0]-'a'][s[len-1]-'a'] = 1; gets(s); } for ( k = 0; k < 26; k++) { for ( i = 0; i < 26; i++) { if (i==k) continue; for ( j = 0; j < 26; j++) { if ( j==k || j==i ) continue; if ( m[i][k] && m[k][j] ) m[i][j] = 1; } } if (m[1][12]) printf("Yes.n"); else printf("No.n"); } getch(); return 0;
|
近期评论