题目

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

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

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

#include<stdio.h>
#include<string.h>
int n,m;
char s2[][];
int vis[];
void fun(){
//a
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMMMMMMMMM1
MM11111111MM
MM11111111MM
MMMMMMMMMMM1
MM11111111MM
MM11111111MM
MMMMMMMMMMM1
*/
//b
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int jj,no=;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
111MMMMMMMM11
1MM1111111MM1
MM111111111MM
MM11111111111
MM111111111MM
1MM1111111MM1
111MMMMMMMM11
*/
//c
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int jj,no=;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(s2[i+][]=='M'||s2[i+][]=='M'){no=;continue;}
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MMMMMMMMMMM111
MM111111111MM1
MM1111111111MM
MM1111111111MM
MM1111111111MM
MM111111111MM1
MMMMMMMMMMM111
*/
//d
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int jj,no=;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMMMMMMMMMM
MM1111111111
MM1111111111
MMMMMMMMMMMM
MM1111111111
MM1111111111
MMMMMMMMMMMM
*/
//e
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MMMMMMMMMMMMM
MM11111111111
MM11111111111
MMMMMMMMMMMMM
MM11111111111
MM11111111111
MM11111111111
*/
//f
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
111MMMMMMMM11
1MM1111111MM1
MM111111111MM
MM11111111111
MM111111MMMMM
1MM1111111MM1
111MMMMMMMMM1
*/
//g
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MM111111111MM
MM111111111MM
MM111111111MM
MMMMMMMMMMMMM
MM111111111MM
MM111111111MM
MM111111111MM
*/
//h
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(x=;x<;x++){
for(jj=j;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
for(jj=j+;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(x=;x<;x++){
for(jj=j;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
for(jj=j+;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MMMMMM
11MM11
11MM11
11MM11
11MM11
11MM11
MMMMMM
*/
//i
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(x=;x<;x++){
for(jj=j+;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
1MMMMMMMM
1111MM111
1111MM111
1111MM111
MM11MM111
MMM1MM111
11MMMM111
*/
//j
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(x=;x<;x++){
for(jj=j+;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MM111111MMM1
MM11111MMM11
MM111MMM1111
MMMMM1111111
MM111MMM1111
MM11111MMM11
MM111111MMMM
*/
//k
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MM1111111111
MMMMMMMMMMMM
*/
//l
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
if(s2[i+][j+]=='M'){no=;continue;}
for(x=;x<;x++){
for(jj=j;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MM1111111111MM
MMMM111111MMMM
MM1MM1111MM1MM
MM11MMMMM111MM
MM1111M11111MM
MM1111111111MM
MM1111111111MM
*/
//m
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(s2[i+][j]!='M'||s2[i+][j+]!='M'||s2[i+][j+]!='M'||
s2[i+][j+]!='M'||s2[i+][j+]!='M'||s2[i+][j+]!='M'||
s2[i+][j+]!='M'||s2[i+][j+]!='M'){no=;continue;}
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(s2[i+][j]!='M'||s2[i+][j+]!='M'||s2[i+][j+]!='M'||
s2[i+][j+]!='M'||s2[i+][j+]!='M'){no=;continue;}
for(x=;x<;x++){
for(jj=j;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
for(jj=j+;jj<j+;jj++)if(s2[i+x][jj]!='M'){no=;break;}if(no==)break;
}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMM111111111MM
MMMM11111111MM
MM1MM1111111MM
MM11MM111111MM
MM1111MM1111MM
MM111111MMM1MM
MM11111111MMMM
*/
//n
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
1111MMMMMM1111",
11MMM1111MMM11",
1MMM111111MMM1",
MM1111111111MM",
1MMM111111MMM1",
11MMM1111MMM11",
1111MMMMMM1111",
*/
//o
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMMMMMMMMM111",
MM111111111MM1",
MM1111111111MM",
MM111111111MM1",
MMMMMMMMMMM111",
MM111111111111",
MM111111111111",
*/
//p
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
if(s2[i+][j+]=='M'){no=;continue;}
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
1111MMMMMM1111",
11MMM1111MMM11",
1MMM111111MMM1",
MM1111111111MM",
1MMM1MMMM1MMM1",
11MMM11MMMMM11",
11111MMMM1MMMM",
*/ //q
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMMMMMMMMM111",
MM111111111MM1",
MM1111111111MM",
MM111111111MM1",
MMMMMMMMMMM111",
MM11111111MM11",
MM111111111MMM",
*/
//r
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
111MMMMMMMM111",
11MM1111111MM1",
1MMM1111111MMM",
111MMMMM111111",
MMM111MMMM1111",
11MMM11111MMM1",
1111MMMMMMM111",
*/
//s
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMMMMMMMMMM",
MMMMMMMMMMMM",
11111MM11111",
11111MM11111",
11111MM11111",
11111MM11111",
11111MM11111",
*/
//t
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MM1111111111MM",
MM1111111111MM",
MM1111111111MM",
MM1111111111MM",
MMM11111111MMM",
MMM11111111MMM",
11MMMMMMMMMM11",
*/
//u
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMMM111111MMMM",
1MMM111111MMM1",
1MMM111111MMM1",
11MMM1111MMM11",
111MMM11MMM111",
1111MM11MM1111",
11111MMMM11111",
*/
//v
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MM1111111111MM",
MM1111111111MM",
1MM111MM111MM1",
1MM111MM111MM1",
1MM111MM111MM1",
1MM1MM11MM1MM1",
11MMM1111MMM11",
*/
//w
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMM111111MMM",
1MMM1111MMM1",
11MMM11MMM11",
1111MMMM1111",
11MMM11MMM11",
1MMM1111MMM1",
MMM111111MMM",
*/
//x
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue; if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
} /*
MMM111111MMM",
1MMM1111MMM1",
11MMM11MMM11",
1111MMMM1111",
11111MM11111",
11111MM11111",
11111MM11111",
*/
//y
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
/*
MMMMMMMMMM1",
1111111MM11",
111111MM111",
11111MM1111",
111MM111111",
11MM1111111",
MMMMMMMMMMM"
*/
//z
if(vis[]==){
for(int i=;i<n-;i++){
for(int j=;j<m;j++){
int x,no=,jj;
for(jj=j;jj<j+;jj++)if(s2[i][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j+;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
for(jj=j;jj<j+;jj++)if(s2[i+][jj]!='M'){no=;break;}if(no==)continue;
if(no==){vis[]=;break;}
}
if(vis[]==)break;
}
}
} int main()
{
char s[][];
while(scanf("%d%d",&n,&m)!=EOF)
{
memset(vis,,sizeof(vis));
for(int i=;i<n;i++)
scanf("%s",s[i]);
memset(s2,,sizeof(s2));
for(int i=;i<n;i++)for(int j=;j<m;j++)s2[i][j]=s[i][j];
fun();
memset(s2,,sizeof(s2));
for(int i=n-;i>=;i--)for(int j=m-;j>=;j--)s2[n-i-][m-j-]=s[i][j];
fun(); for(int i=;i<;i++)
if(vis[i]==)printf("%c",'A'+i);
puts("");
}
return ;
}

纯模拟

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

  1. 无线网络发射器选址 (NOIP2014)(真·纯模拟)

    原题传送门 好吧,如果说D1T1是纯模拟大水题 D2T1就是纯模拟略水题. 这道题首先我们要看一看数据范围.. 0<=n,m<=128 送分也不带这么送的吧.. 二维前缀和,前缀和,二次循 ...

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

    原题传送门 这是道很奇怪的题目,真不知道为什么要放到T2. 也许是T1太水了 首先先看题, 题目要求一个数列中下标为偶数的点比临近的下表为奇数的点更大或更小 其实就是说在原数组中找到一个最长的波动数列 ...

  3. ZOJ 3790 Consecutive Blocks 模拟题

    problemCode=3790">Consecutive Blocks 先离散一下,然后模拟,把一种颜色i所在的位置都放入G[i]中.然后枚举一下终点位置,滑动窗体使得起点和终点间花 ...

  4. ZOJ 3826 Hierarchical Notation 模拟

    模拟: 语法的分析 hash一切Key建设规划,对于记录在几个地点的每个节点原始的字符串开始输出. . .. 对每一个询问沿图走就能够了. .. . Hierarchical Notation Tim ...

  5. 神奇的幻方(NOIP2015)(真·纯模拟)

    原题传送门 这是道SB模拟题,NOIP--难度 直接贴代码 #include<iostream> #include<cstdio> using namespace std; , ...

  6. ZOJ How Many Nines 模拟 | 打表

    How Many Nines Time Limit: 1 Second      Memory Limit: 65536 KB If we represent a date in the format ...

  7. ZOJ——String Successor(字符串模拟题目)

    ZOJ Problem Set - 3490 String Successor Time Limit: 2 Seconds      Memory Limit: 65536 KB The succes ...

  8. ZOJ 3778 Talented Chef 模拟 [ 祝愿明天省赛一帆风顺, ZJSU_Bloom WILL WIN : )

    这题的意思是给你 n 道菜,第 i 道菜需要 Ai 步才能完成 每次你能对 m 道菜分别完成一步,请问最少需要几次? 这题暴力写肯定是不行的,去年省赛的时候就是没写出来这题,今天再把思路理一理吧. 首 ...

  9. ZOJ 3818 Pretty Poem 模拟题

    这题在比赛的时候WA到写不出来,也有判断ABC子串不一样不过写的很差一直WA 在整理清思路后重写一遍3Y 解题思路如下: 第一种情况:ABABA. 先判断开头的A与结尾的A,得到A的长度, 接着判断A ...

随机推荐

  1. Python3基础(二) 基本数据类型

    Python中的变量不需要声明.每个变量在使用前都必须赋值,变量赋值以后该变量才会被创建.在Python中,变量就是变量,它没有类型,我们所说的"类型"是变量所指的内存中对象的类型 ...

  2. Linux下C++访问MySQL数据库

    由于想要开始了解并学习用LAMP进行web开发,所以昨晚我在Fedora上安装了MySQL,学习了MySQL的几个常用命令.想着在学习进行web开发(PHP访问数据库)之前,先用我熟悉的C++连接数据 ...

  3. 【POJ3074】Sudoku DLX(Dancing Links)

    数独就要DLX,不然不乐意. 数独的DLX构造:9*9个点每一个点有9种选择,这构成了DLX的729行,每行.列.阵有限制,均为9行(/列/阵),然后每行(/列/阵)都有九种数的情况.于是就有了3*9 ...

  4. ios block 内存管理时使用注意

    XMGStudent *stu = [[XMGStudent alloc] init]; __weak XMGStudent *weakStu = stu; stu.block = ^{ NSLog( ...

  5. ChromeDriver only supports characters in the BMP

    ChromeDriver only supports characters in the BMP

  6. 【转】Android 关闭多个视图Intent.FLAG_ACTIVITY_CLEAR_TOP用法

    如果已经启动了四个Activity:A,B,C和D.在D Activity里,我们要跳到B Activity,同时希望C finish掉, 可以在startActivity(intent)里的inte ...

  7. ALSA声卡驱动中的DAPM详解之一:kcontrol

    DAPM是Dynamic Audio Power Management的缩写,直译过来就是动态音频电源管理的意思,DAPM是为了使基于linux的移动设备上的音频子系统,在任何时候都工作在最小功耗状态 ...

  8. Android TP(三)【转】

    本文转载自:http://blog.csdn.net/bi511304183/article/details/9303259 平台信息:内核:linux2.6/linux3.0系统:android/a ...

  9. MarkMonitor 目前最安全的域名注册商,因此,世界500强网站中的22%域名托管于markmonitor公司

    也许你查询某个大型公司域名whios信息时,常常会发现很多这些大型公司的域名都在一家名为MarkMonitor的公司注册,那么markmonitor是家什么样的公司呢? MarkMonitor是一家从 ...

  10. go语言笔记——指针,和C用法以及本质一样,但不支持指针的+-运算!

    4.4.2 值类型和引用类型 所有像 int.float.bool 和 string 这些基本类型都属于值类型,使用这些类型的变量直接指向存在内存中的值. Go 语言的取地址符是 &,放到一个 ...