题意:求出2^k次方个 2^k维的互相叉乘都是0的向量。'+'表示1, '*'表示0。
无限YY。。。就这么过了。
每个方案分左上、右上、左下、右下4部分。左上、下相同,右上一半与同左上,另一半相反,右上右下相反。
AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <string>
#define INF 0x3f3f3f3f
#define eps 1e-8
#define MAXN (2000+10)
#define MAXM (500000)
#define Ri(a) scanf("%d", &a)
#define Rl(a) scanf("%lld", &a)
#define Rf(a) scanf("%lf", &a)
#define Rs(a) scanf("%s", a)
#define Pi(a) printf("%d\n", (a))
#define Pf(a) printf("%.2lf\n", (a))
#define Pl(a) printf("%lld\n", (a))
#define Ps(a) printf("%s\n", (a))
#define W(a) while(a--)
#define CLR(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define LL long long
#define lson o<<1, l, mid
#define rson o<<1|1, mid+1, r
#define ll o<<1
#define rr o<<1|1
#define PI acos(-1.0)
using namespace std;
char Map[MAXN][MAXN];
void getMap(int n)
{
Map[0][0] = '+';
for(int k = 1; k <= n; k++)
{
int len = 1<<(k-1);
int lcul = 1<<(k-1), rcul = 1<<k;
int lrow = 0, rrow = 1<<(k-1);
for(int i = lrow; i <= rrow/2; i++)
for(int j = lcul; j < rcul; j++)
Map[i][j] = Map[i][j-len] == '+' ? '*' : '+';
for(int i = rrow/2; i < rrow; i++)
for(int j = lcul; j < rcul; j++)
Map[i][j] = Map[i][j-len];
lcul = 0; rcul = 1<<(k-1);
lrow = 1<<(k-1); rrow = 1<<k;
for(int i = lrow; i < rrow; i++)
for(int j = lcul; j < rcul; j++)
Map[i][j] = Map[i-len][j];
lcul = 1<<(k-1); rcul = 1<<k;
lrow = 1<<(k-1); rrow = 1<<k;
for(int i = lrow; i < rrow; i++)
for(int j = lcul; j < rcul; j++)
Map[i][j] = Map[i-len][j] == '+' ? '*' : '+';
}
}
int main()
{
int k; Ri(k);
getMap(k);
for(int i = 0; i < (1<<k); i++)
Ps(Map[i]);
return 0;
}