标签:
4 4 2 0010 0010 0111 0010 0010 0110 0111 0010
1 1
#include<cstdio> #include<cstring> #include<iostream> #define ref(i,a,b) for(i=a;i<=b;i++) using namespace std; int a[22],n,m,t; char c[22][22]; int main() { cin>>n>>m>>t; scanf("\n"); while (t-->0){ int i,j; memset(a,0,sizeof(a)); ref(i,1,n){ ref(j,1,m){ cin>>c[i][j]; } scanf("\n"); } int v; ref(j,1,m){ v=1; ref(i,1,n){//我是把整个图顺时针转了90度,更好操作 a[j]+=v*(c[i][j]-48);//二进制转换成十进制状态 v*=2; } } int ans=0,k,b[21],al=(1<<n)-1; ref(a[0],0,al){ ref(i,0,m) b[i]=a[i]; ref(i,1,m){ b[i]=(b[i]^(b[i-1]*2)^(b[i-1]*4)^(b[i-1]/4)^(b[i-1]/2)^b[i-1])&al; //操作当前的状态 b[i+1]=(b[i+1]^b[i-1])&al;//操作下一状态 } if ((b[m]&al)==0) ans++; } cout<<ans<<endl; } return 0; } /*http://blog.csdn.net/hzj1054689699/article/details/50571564*/
标签:
原文地址:http://www.cnblogs.com/shenben/p/5564136.html