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 |
水#include <stdio.h> int i(char *t){ int r=0; for(int i=0;i<7;i++){ r |= ((t[i]=='Y') << i); } return r; } int main() { int g[10] = {63,6,91,79,102,109,125,7,127,111}; int n; while(1){ scanf("%d",&n); if(!n)return 0; int d = n; int a[10]; while(d--){ char t[10]; scanf("%s",t); a[d]=i(t); } bool k=0; for(int j=0;j<=10-n;j++){ bool K=1; int h=0; for(int q=n-1;q>=0;q--){ if((a[q]&g[j+q])^a[q]){ K=0; break; } int H=(a[q]^g[j+q])|h, O=a[q]; if(O&H){ K=0; break; } h=H; } if(K){ k=1; break; } } if(k) printf("MATCH\n"); else printf("MISMATCH\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