time limit per test3 seconds

memory limit per test256 megabytes

inputstandard input

outputstandard output

The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the group a simple task: find 4 vectors in 4-dimensional space, such that every coordinate of every vector is 1 or  - 1 and any two vectors are orthogonal. Just as a reminder, two vectors in n-dimensional space are considered to be orthogonal if and only if their scalar product is equal to zero, that is:

.

Danil quickly managed to come up with the solution for this problem and the teacher noticed that the problem can be solved in a more general case for 2k vectors in 2k-dimensinoal space. When Danil came home, he quickly came up with the solution for this problem. Can you cope with it?

Input

The only line of the input contains a single integer k (0 ≤ k ≤ 9).

Output

Print 2k lines consisting of 2k characters each. The j-th character of the i-th line must be equal to ’ * ’ if the j-th coordinate of the i-th vector is equal to  - 1, and must be equal to ’ + ’ if it’s equal to  + 1. It’s guaranteed that the answer always exists.

If there are many correct answers, print any.

Examples

input

2

output

++**

++

++++

+**+

Note

Consider all scalar products in example:

Vectors 1 and 2: ( + 1)·( + 1) + ( + 1)·( - 1) + ( - 1)·( + 1) + ( - 1)·( - 1) = 0

Vectors 1 and 3: ( + 1)·( + 1) + ( + 1)·( + 1) + ( - 1)·( + 1) + ( - 1)·( + 1) = 0

Vectors 1 and 4: ( + 1)·( + 1) + ( + 1)·( - 1) + ( - 1)·( - 1) + ( - 1)·( + 1) = 0

Vectors 2 and 3: ( + 1)·( + 1) + ( - 1)·( + 1) + ( + 1)·( + 1) + ( - 1)·( + 1) = 0

Vectors 2 and 4: ( + 1)·( + 1) + ( - 1)·( - 1) + ( + 1)·( - 1) + ( - 1)·( + 1) = 0

Vectors 3 and 4: ( + 1)·( + 1) + ( + 1)·( - 1) + ( + 1)·( - 1) + ( + 1)·( + 1) = 0

【题解】



规律题;

k和k-1的答案存在如下关系;



上图中的方框表示k-1时的答案;

把它按照上述方式复制3份,第4份则在原来的基础上取反;(用1表示+,0表示减);

比如样例输入

++**
+*+*
++++
+**+
//->
1100
1010
1111
1001
//->相同的3份取反的一份
1100 1100
1010 1010
1111 1111
1001 1001 1100 0011
1010 0101
1111 0000
1001 0110
/*而这正是k=3时的答案;右下角那个
上面两个方框是肯定满足的;
为了让下面两个方框在乘的时候也满足;
相当于左边取A,右边取它的相反数-A;这样一减就是0;
如果一个答案符合要求则全部取反还是能符合要求的;
所以右下角取反不会影响下面两个的答案正确性;
然后又能让上面两个方框的乘下面两个方框的向量的时候积为0;所以是符合要求的;
*/
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <stack>
#include <string>
#define lson L,m,rt<<1
#define rson m+1,R,rt<<1|1
#define LL long long using namespace std; const int MAXN = 1000;
const int dx[5] = {0,1,-1,0,0};
const int dy[5] = {0,0,0,-1,1};
const double pi = acos(-1.0);
struct abc
{
int a[1000][1000];
}; int k;
abc ans[10]; void input_LL(LL &r)
{
r = 0;
char t = getchar();
while (!isdigit(t) && t!='-') t = getchar();
LL sign = 1;
if (t == '-')sign = -1;
while (!isdigit(t)) t = getchar();
while (isdigit(t)) r = r * 10 + t - '0', t = getchar();
r = r*sign;
} void input_int(int &r)
{
r = 0;
char t = getchar();
while (!isdigit(t)&&t!='-') t = getchar();
int sign = 1;
if (t == '-')sign = -1;
while (!isdigit(t)) t = getchar();
while (isdigit(t)) r = r * 10 + t - '0', t = getchar();
r = r*sign;
} int main()
{
// freopen("F:\\rush.txt","r",stdin);
ans[0].a[1][1] = 0;
for (k= 1;k <= 9;k++)
{
for (int i = 1;i <= 1<<(k-1);i++)
for (int j = 1;j <= 1<<(k-1);j++)
{
ans[k].a[i][j] = ans[k-1].a[i][j];
ans[k].a[i+(1<<(k-1))][j] = ans[k-1].a[i][j];
ans[k].a[i][j+(1<<(k-1))] = ans[k].a[i][j];
ans[k].a[i+(1<<(k-1))][j+(1<<(k-1))] = !ans[k].a[i][j];
}
}
input_int(k);
for (int i = 1;i <= 1<<k;i++)
{
for (int j = 1;j <= 1<<k;j++)
if (ans[k].a[i][j])
putchar('+');
else
putchar('*');
puts("");
}
return 0;
}

【53.57%】【codeforces 610C】Harmony Analysis的更多相关文章

  1. Codeforces 610C:Harmony Analysis(构造)

    [题目链接] http://codeforces.com/problemset/problem/610/C [题目大意] 构造出2^n个由1和-1组成的串使得其两两点积为0 [题解] 我们可以构造这样 ...

  2. 【53.57%】【codeforces 722D】Generating Sets

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  3. 【 BowWow and the Timetable CodeForces - 1204A 】【思维】

    题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制 ...

  4. 【57.97%】【codeforces Round #380A】Interview with Oleg

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. 【34.57%】【codeforces 557D】Vitaly and Cycle

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  6. 【Educational Codeforces Round 53 (Rated for Div. 2) C】Vasya and Robot

    [链接] 我是链接,点我呀:) [题意] [题解] 如果|x|+|y|>n 显然.从(0,0)根本就没法到(x,y) 但|x|+|y|<=n还不一定就能到达(x,y) 注意到,你每走一步路 ...

  7. 【codeforces 750C】New Year and Rating(做法2)

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. 【codeforces 750A】New Year and Hurry

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  9. 【codeforces 750C】New Year and Rating

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

随机推荐

  1. KiCad 5.1.0 镜像圆弧后错位问题

    KiCad 5.1.0 镜像圆弧后错位问题 看官方回复这个问题将在 5.1.3 进行修复,因为这段时间在举行 KiCon 活动. 看到这个问题并不是非常严重,不是致命的,所以已经从 5.1.0 跳到 ...

  2. c50决策树借款风险

    Decision Trees/ Machine Learning Durga Gaddam August 29, 2016 Objective: The objective of the articl ...

  3. vuex之仓库数据的设置与获取

    如果你之前使用过vue.js,你一定知道在vue中各个组件之间传值的痛苦,在vue中我们可以使用vuex来保存我们需要管理的状态值,值一旦被修改,所有引用该值的地方就会自动更新,那么接下来我们就来学习 ...

  4. Tcp之双向通信

    TestServer.java package com.sxt.tcp; /* * 服务端 */ import java.io.DataInputStream; import java.io.Data ...

  5. 模板—扩展GCD*2

    有必要重新学一下扩展GCD emmmm. 主要是扩展GCD求解线性同余方程$ax≡b (mod p)$. 1.方程有解的充分必要条件:b%gcd(a,p)=0. 证明: $ax-py=b$ 由于求解整 ...

  6. Navicat连接MySQL8.0版本时 建议升级连接客户端这个提示怎么办

    开始->mysql 8.0 command line client ->执行下面的命令//开启mysql服务mysql.server start//进入mysqlmysql -u root ...

  7. Jmeter处理数据库

    安装环境: jmeter版本:3.1版本 java1.8版本 安装步骤: 1.下载连接mysql数据库jar包,地址:https://pan.baidu.com/s/10k6zD6CU4mo7xYJF ...

  8. 容器安全拾遗 - Rootless Container初探

    摘要: Docker和Kubernetes已经成为企业IT架构的基础设施,安全容器运行时越来越被关注.近期Docker 19.03中发布了一个重要的特性 “Rootless Container”,在提 ...

  9. Jquery常用方法汇总(转)

    https://blog.csdn.net/lucky___star/article/details/87883888

  10. OpenStack组件系列☞Keystone搭建

    一:版本信息 官网:http://docs.openstack.org/newton/install-guide-rdo/keystone.html 二:部署keystone 官网文档:http:// ...