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 |
Could anyone give me some special datas? Here is my code! Headache!!!#include <cstdio> char map[10][8]; void init() { int i,j; char a='N'; for(i=0;i<=9;i++) for(j=1;j<=7;j++) map[i][j]='Y'; map[0][7]=a; map[9][5]=a; for(i=4;i<=7;i++) map[7][i]=a; map[6][2]=a; map[5][2]=map[5][5]=a; map[4][1]=map[4][4]=map[4][5]=a; map[3][5]=map[3][6]=a; map[2][3]=map[2][6]=a; map[1][1]=a; for(i=4;i<=7;i++) map[1][i]=a; } int main() { init(); int n,i,j,k; char a[12][8]; while(scanf("%d",&n) && n) { for(i=1;i<=n;i++) { getchar(); for(j=1;j<=7;j++) scanf("%c",&a[i][j]); } int flag=9; bool ans=0; while(flag>=0 && flag-n+1>=0) { for(i=1,j=flag;i<=n;i++,j--) { for(k=1;k<=7;k++) { if(map[j][k]=='N' && a[i][k]=='Y') break; } if(k<=7) break; } if(i>n) { ans=1; break; } flag--; } if(ans==1) 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