Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Posted by KatrineYang at 2016-11-07 14:14:00 on Problem 1495 and last updated at 2016-11-07 14:15:41
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator