ZOJ 3656
位运算一定要加括号。。。
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif
/************ for topcoder by zz1215 *******************/
#define FOR(i,a,b) for( int i = (a) ; i <= (b) ; i ++)
#define FF(i,a) for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a,b) for( int i = (a) ; i >= (b) ; i --)
#define S64(a) scanf(in64,&a)
#define SS(a) scanf("%d",&a)
#define LL(a) ((a)<<1)
#define RR(a) (((a)<<1)+1)
#define pb push_back
#define CL(Q) while(!Q.empty())Q.pop()
#define MM(name,what) memset(name,what,sizeof(name))
#define MC(a,b) memcpy(a,b,sizeof(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-9;
const double pi = acos(-1.0);
const int maxn = 511;
int n;
int a[maxn][maxn];
bool x[maxn];
bool can(int pos,int w)
{
x[0]=w;
bool temp;
for(int i=1;i<n;i++)
{
if(i%2==1)
{
temp = (a[0][i]>>pos)&1;
x[i] = x[0]^temp;
x[i] &= 1;
}
}
for(int i=2;i<n;i++)
{
if(i%2==0)
{
temp = (a[1][i]>>pos)&1;
x[i] = x[1]^temp;
x[i] &= 1;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
temp = (a[i][j]>>pos)&1;
if(i==j)
{
if(temp) return false;
}
else if (i % 2 == 1 && j % 2 == 1)
{
if( temp != (x[i]|x[j]))
{
return false;
}
}
else if (i % 2 == 0 && j % 2 == 0)
{
if(temp!= (x[i]&x[j]))
{
return false;
}
}
else
{
if(temp != (x[i]^x[j]))
{
return false;
}
}
}
}
return true;
}
bool start()
{
for(int i=0;i<=30;i++)
{
if(!can(i,0) && !can(i,1)) return false;
}
return true;
}
int main()
{
while(cin>>n)
{
for(int i=0;i<n;i++)
{
&n
补充:软件开发 , C++ ,