zoj 3314 CAPTCHA(纯模拟)

题目

有些人用深搜写的,当然我这弱弱的,只理解纯模拟。。。

纯模拟,第一次写了那么长的代码,我自己也是够坚韧不拔的,,,,必须留念啊!!!

注意,G包含C,E包含L,R包含P,(照图说O应该不包含C,但是不排除掉这种情况,就wa掉了,所以要排除O包含C的情况。。)

#include<stdio.h>
#include<string.h>
int n,m;
char s2[330][330];
int vis[30];
void fun(){
    //a
    if(vis[0]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int no=0,jj;
                for(jj=j+5;jj<j+8;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+9;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+5;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+10;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+11;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[0]=1;break;}
            }
            if(vis[0]==1)break;
        }
    }

/*
MMMMMMMMMMM1
MM11111111MM
MM11111111MM
MMMMMMMMMMM1
MM11111111MM
MM11111111MM
MMMMMMMMMMM1
*/
    //b
    if(vis[1]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int jj,no=0;
                for(jj=j;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[1]=1;break;}
            }
            if(vis[1]==1)break;
        }
    }
/*
111MMMMMMMM11
1MM1111111MM1
MM111111111MM
MM11111111111
MM111111111MM
1MM1111111MM1
111MMMMMMMM11
*/
    //c
    if(vis[2]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int jj,no=0;
                for(jj=j+3;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(s2[i+3][11]==‘M‘||s2[i+4][10]==‘M‘){no=1;continue;}
                for(jj=j+1;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+11;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[2]=1;break;}
            }
            if(vis[2]==1)break;
        }
    }
/*
MMMMMMMMMMM111
MM111111111MM1
MM1111111111MM
MM1111111111MM
MM1111111111MM
MM111111111MM1
MMMMMMMMMMM111
*/
    //d
    if(vis[3]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int jj,no=0;
                for(jj=j;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[3]=1;break;}
            }
            if(vis[3]==1)break;
        }
    }

/*
MMMMMMMMMMMM
MM1111111111
MM1111111111
MMMMMMMMMMMM
MM1111111111
MM1111111111
MMMMMMMMMMMM
*/
    //e
    if(vis[4]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int no=0,jj;
                for(jj=j;jj<j+12;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+12;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[4]=1;break;}
            }
            if(vis[4]==1)break;
        }
    }
/*
MMMMMMMMMMMMM
MM11111111111
MM11111111111
MMMMMMMMMMMMM
MM11111111111
MM11111111111
MM11111111111
*/
    //f
    if(vis[5]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int no=0,jj;
                for(jj=j;jj<j+13;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+13;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[5]=1;break;}
            }
            if(vis[5]==1)break;
        }
    }

/*
111MMMMMMMM11
1MM1111111MM1
MM111111111MM
MM11111111111
MM111111MMMMM
1MM1111111MM1
111MMMMMMMMM1
*/
    //g
    if(vis[6]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int no=0,jj;
                for(jj=j+3;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+13;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[6]=1;break;}
            }
            if(vis[6]==1)break;
        }
    }

/*
MM111111111MM
MM111111111MM
MM111111111MM
MMMMMMMMMMMMM
MM111111111MM
MM111111111MM
MM111111111MM
*/
    //h
    if(vis[7]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(x=0;x<3;x++){
                    for(jj=j;jj<j+2;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                    for(jj=j+11;jj<j+13;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;
                for(jj=j;jj<j+13;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(x=4;x<7;x++){
                    for(jj=j;jj<j+2;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                    for(jj=j+11;jj<j+13;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;

                if(no==0){vis[7]=1;break;}
            }
            if(vis[7]==1)break;
        }
    }
/*
MMMMMM
11MM11
11MM11
11MM11
11MM11
11MM11
MMMMMM
*/
    //i
    if(vis[8]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+6;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(x=1;x<6;x++){
                    for(jj=j+2;jj<j+4;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;
                for(jj=j;jj<j+6;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[8]=1;break;}
            }
            if(vis[8]==1)break;
        }
    }

/*
1MMMMMMMM
1111MM111
1111MM111
1111MM111
MM11MM111
MMM1MM111
11MMMM111
*/
    //j
    if(vis[9]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j+1;jj<j+9;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(x=1;x<4;x++){
                    for(jj=j+4;jj<j+6;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+6;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;

                if(no==0){vis[9]=1;break;}
            }
            if(vis[9]==1)break;
        }
    }

/*
MM111111MMM1
MM11111MMM11
MM111MMM1111
MMMMM1111111
MM111MMM1111
MM11111MMM11
MM111111MMMM
*/
    //k
    if(vis[10]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+2;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+10;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+8;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+5;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+8;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+10;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[10]=1;break;}
            }
            if(vis[10]==1)break;
        }
    }

/*
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MMMMMMMMMMMM
*/
    //l
    if(vis[11]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                if(s2[i+3][j+2]==‘M‘){no=1;continue;}
                for(x=0;x<6;x++){
                    for(jj=j;jj<j+2;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;
                for(jj=j;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[11]=1;break;}
            }
            if(vis[11]==1)break;
        }
    }

/*
MM1111111111MM
MMMM111111MMMM
MM1MM1111MM1MM
MM11MMMMM111MM
MM1111M11111MM
MM1111111111MM
MM1111111111MM
*/
    //m
    if(vis[12]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+2;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+14;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(s2[i+2][j]!=‘M‘||s2[i+2][j+1]!=‘M‘||s2[i+2][j+3]!=‘M‘||
                    s2[i+2][j+4]!=‘M‘||s2[i+2][j+9]!=‘M‘||s2[i+2][j+10]!=‘M‘||
                    s2[i+2][j+12]!=‘M‘||s2[i+2][j+13]!=‘M‘){no=1;continue;}
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+9;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(s2[i+4][j]!=‘M‘||s2[i+4][j+1]!=‘M‘||s2[i+4][j+6]!=‘M‘||
                    s2[i+4][j+12]!=‘M‘||s2[i+4][j+13]!=‘M‘){no=1;continue;}
                for(x=5;x<7;x++){
                    for(jj=j;jj<j+2;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                    for(jj=j+12;jj<j+14;jj++)if(s2[i+x][jj]!=‘M‘){no=1;break;}if(no==1)break;
                }if(no==1)continue;

                if(no==0){vis[12]=1;break;}
            }
            if(vis[12]==1)break;
        }
    }

/*
MMM111111111MM
MMMM11111111MM
MM1MM1111111MM
MM11MM111111MM
MM1111MM1111MM
MM111111MMM1MM
MM11111111MMMM
*/
    //n
    if(vis[13]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+3;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+5;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+8;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+14;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;

                if(no==0){vis[13]=1;break;}
            }
            if(vis[13]==1)break;
        }
    }

/*
1111MMMMMM1111",
11MMM1111MMM11",
1MMM111111MMM1",
MM1111111111MM",
1MMM111111MMM1",
11MMM1111MMM11",
1111MMMMMM1111",
*/
        //o
    if(vis[14]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j+4;jj<j+10;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+10;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[14]=1;break;}
            }
            if(vis[14]==1)break;
        }
    }

/*
MMMMMMMMMMM111",
MM111111111MM1",
MM1111111111MM",
MM111111111MM1",
MMMMMMMMMMM111",
MM111111111111",
MM111111111111",
*/
    //p
    if(vis[15]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                if(s2[i+5][j+11]==‘M‘){no=1;continue;}
                for(jj=j;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[15]=1;break;}
            }
            if(vis[15]==1)break;
        }
    }

/*
1111MMMMMM1111",
11MMM1111MMM11",
1MMM111111MMM1",
MM1111111111MM",
1MMM1MMMM1MMM1",
11MMM11MMMMM11",
11111MMMM1MMMM",
*/

    //q
    if(vis[16]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j+4;jj<j+10;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+9;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+9;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+14;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[16]=1;break;}
            }
            if(vis[16]==1)break;
        }
    }

/*
MMMMMMMMMMM111",
MM111111111MM1",
MM1111111111MM",
MM111111111MM1",
MMMMMMMMMMM111",
MM11111111MM11",
MM111111111MMM",
*/
    //r
    if(vis[17]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+12;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+14;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[17]=1;break;}
            }
            if(vis[17]==1)break;
        }
    }

    /*
111MMMMMMMM111",
11MM1111111MM1",
1MMM1111111MMM",
111MMMMM111111",
MMM111MMMM1111",
11MMM11111MMM1",
1111MMMMMMM111",
*/
    //s
    if(vis[18]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j+3;jj<j+11;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+8;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+10;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+11;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[18]=1;break;}
            }
            if(vis[18]==1)break;
        }
    }

/*
MMMMMMMMMMMM",
MMMMMMMMMMMM",
11111MM11111",
11111MM11111",
11111MM11111",
11111MM11111",
11111MM11111",
*/
    //t
    if(vis[19]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+12;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+12;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[19]=1;break;}
            }
            if(vis[19]==1)break;
        }
    }
/*
MM1111111111MM",
MM1111111111MM",
MM1111111111MM",
MM1111111111MM",
MMM11111111MMM",
MMM11111111MMM",
11MMMMMMMMMM11",
*/
    //u
    if(vis[20]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+2;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+14;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+14;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[20]=1;break;}
            }
            if(vis[20]==1)break;
        }
    }

/*
MMMM111111MMMM",
1MMM111111MMM1",
1MMM111111MMM1",
11MMM1111MMM11",
111MMM11MMM111",
1111MM11MM1111",
11111MMMM11111",
*/
    //v
    if(vis[21]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+4;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+14;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+10;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+6;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+10;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+9;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[21]=1;break;}
            }
            if(vis[21]==1)break;
        }
    }
/*
MM1111111111MM",
MM1111111111MM",
1MM111MM111MM1",
1MM111MM111MM1",
1MM111MM111MM1",
1MM1MM11MM1MM1",
11MMM1111MMM11",
*/
    //w
    if(vis[22]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+2;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+2;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+12;jj<j+14;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+8;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+8;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+8;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+3;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+6;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+10;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+11;jj<j+13;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;

                if(no==0){vis[22]=1;break;}
            }
            if(vis[22]==1)break;
        }
    }

/*
MMM111111MMM",
1MMM1111MMM1",
11MMM11MMM11",
1111MMMM1111",
11MMM11MMM11",
1MMM1111MMM1",
MMM111111MMM",
*/
    //x
    if(vis[23]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+3;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+3;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+10;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+10;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+8;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;

                if(no==0){vis[23]=1;break;}
            }
            if(vis[23]==1)break;
        }
    }

/*
MMM111111MMM",
1MMM1111MMM1",
11MMM11MMM11",
1111MMMM1111",
11111MM11111",
11111MM11111",
11111MM11111",
*/
    //y
    if(vis[24]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+3;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+9;jj<j+12;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+1;jj<j+4;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+8;jj<j+11;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+5;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+10;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+4;jj<j+8;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[24]=1;break;}
            }
            if(vis[24]==1)break;
        }
    }
/*
MMMMMMMMMM1",
1111111MM11",
111111MM111",
11111MM1111",
111MM111111",
11MM1111111",
MMMMMMMMMMM"
*/
    //z
    if(vis[25]==0){
        for(int i=0;i<n-6;i++){
            for(int j=0;j<m;j++){
                int x,no=0,jj;
                for(jj=j;jj<j+10;jj++)if(s2[i][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+7;jj<j+9;jj++)if(s2[i+1][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+6;jj<j+8;jj++)if(s2[i+2][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+5;jj<j+7;jj++)if(s2[i+3][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+3;jj<j+5;jj++)if(s2[i+4][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j+2;jj<j+4;jj++)if(s2[i+5][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                for(jj=j;jj<j+11;jj++)if(s2[i+6][jj]!=‘M‘){no=1;break;}if(no==1)continue;
                if(no==0){vis[25]=1;break;}
            }
            if(vis[25]==1)break;
        }
    }
}

int main()
{
    char s[330][330];
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        memset(vis,0,sizeof(vis));
        for(int i=0;i<n;i++)
            scanf("%s",s[i]);
        memset(s2,0,sizeof(s2));
        for(int i=0;i<n;i++)for(int j=0;j<m;j++)s2[i][j]=s[i][j];
        fun();
        memset(s2,0,sizeof(s2));
        for(int i=n-1;i>=0;i--)for(int j=m-1;j>=0;j--)s2[n-i-1][m-j-1]=s[i][j];
        fun();

        for(int i=0;i<26;i++)
            if(vis[i]==1)printf("%c",‘A‘+i);
        puts("");
    }
    return 0;
}

纯模拟

时间: 2024-10-28 10:26:53

zoj 3314 CAPTCHA(纯模拟)的相关文章

ZOJ 1760 &amp;&amp;POJ1552 Doubles (模拟)

链接:click here 题意:叫你求一个数是另一个数的二倍的这样的组合有多少个. 思路:纯模拟,一重循环:读入当前数据组a,并累积数据元素个数n,循环的结束标志是读入数据0,两重循环结构枚举组内所有数据对a[i] a[j] 判断是否成两倍关系 代码: #include <stdio.h> #include <string.h> #include <math.h> #include <iostream> #include <algorithm>

花匠(NOIP2013)(神奇纯模拟)

原题传送门 这是道很奇怪的题目,真不知道为什么要放到T2. 也许是T1太水了 首先先看题, 题目要求一个数列中下标为偶数的点比临近的下表为奇数的点更大或更小 其实就是说在原数组中找到一个最长的波动数列,就是小大小大小大...或者大小大小大小 网络上的题解都写的奇奇怪怪,有的用递归,有的用贪心.. 其实没有那么麻烦. 我们假设从第一个数之后开始所有的点都是拐点. 然后就设一个BOOL 如果bool=1那么就判断a[i]>a[i-1]如果满足ans++;bool=0; 如果bool=0那么就判断a[

HDU 1986 &amp; ZOJ 2989 Encoding(模拟)

题目链接: HDU: http://acm.hdu.edu.cn/showproblem.php?pid=1986 ZOJ: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1988 HDU 1987 & ZOJ 2990 和这题刚好相反,也是比较容易模拟: Chip and Dale have devised an encryption method to hide their (written) text messages

[ACM] ZOJ 3844 Easy Task (模拟+哈希)

Easy Task Time Limit: 2 Seconds      Memory Limit: 65536 KB You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n integers. And then you should replace both a and bwith a-b. Yo

ZOJ How Many Nines 模拟 | 打表

How Many Nines Time Limit: 1 Second      Memory Limit: 65536 KB If we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y2-M2-D2 (both inclusive)? Note that

zoj 3826 Hierarchical Notation(模拟)

题目链接:zoj 3826 Hierarchical Notation 题目大意:给定一些结构体.结构体有value值和key值,Q次询问,输出每一个key值相应的value值. 解题思路:思路非常easy.写个类词法的递归函数,每次将key值映射成一个hash值,用map映射每一个key的value起始终止位置,预处理完了查询就非常easy了. 这题是最后10分钟出的.由于没有考虑value为{}的情况,导致RE了.可是zoj上显示的是SE,表示不理解什么意思,事实上就是RE.只是另一个地方会

CodeForces - 200DProgramming Language纯模拟

CodeForces - 200D Programming Language Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Recently, Valery have come across an entirely new programming language. Most of all the language attracted h

神奇的幻方(NOIP2015)(真&#183;纯模拟)

原题传送门 这是道SB模拟题,NOIP--难度 直接贴代码 #include<iostream> #include<cstdio> using namespace std; int n,num=1,zong,heng; int f[41][41]; int main(){ scanf("%d",&n); heng=n/2+1; zong=1; while(num<=n*n){ f[heng][zong]=num; if(f[heng+1][zong

ZOJ 3180 Number Game(模拟,倒推)

题目 思路: 先倒推!到最后第二步,然后: 初始状态不一定满足这个状态.所以我们要先从初始状态构造出它出发的三种状态.那这三种状态跟倒推得到的状态比较即可. #include<stdio.h> #include<string.h> #include <algorithm> using namespace std; int t,a[5],b[5]; int main() { scanf("%d",&t); while(t--) { scanf(