CF610C.Harmony Analysis

普及+/提高

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 2_k_ vectors in 2_k_-dimensinoal space. When Danil came home, he quickly came up with the solution for this problem. Can you cope with it?

学期即将结束,丹尼尔决定去听一节和声分析课,至少看看教授长什么样子。丹尼尔在课堂上感到非常无聊,直到老师给全班布置了一个简单任务:在四维空间中找出 4 个向量,使得每个向量的每个坐标分量均为 11 或 −1-1,且任意两个向量彼此正交。作为提醒,nn 维空间中的两个向量被认为是正交的,当且仅当它们的标量积(点积)为零,即:

丹尼尔很快便解决了这个问题,老师注意到该问题可推广到更一般的情形:在 2k2^k 维空间中寻找 2k2^k 个向量。丹尼尔回家后也迅速给出了该推广问题的解法。你能否解决它?

输入格式

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

输入仅包含一行,其中有一个整数 kk(0 ≤ k ≤ 90 \le k \le 9)。

输出格式

Print 2_k_ lines consisting of 2_k_ 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.

输出 2k2^k 行,每行包含 2k2^k 个字符。第 ii 行的第 jj 个字符应为 ' * ',当且仅当第 ii 个向量的第 jj 个坐标等于 −1-1;应为 ' + ',当且仅当该坐标等于 +1+1。保证答案一定存在。

如果存在多个正确答案,输出任意一个即可。

输入输出样例

  • 输入#1

    2

    输出#1

    ++**
    +*+*
    ++++
    +**+

说明/提示

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

考虑示例中的所有标量积:

  • 向量 1 和 2:(+1)⋅(+1)+(+1)⋅(−1)+(−1)⋅(+1)+(−1)⋅(−1)=0(+1)\cdot(+1)+( +1)\cdot(-1)+(-1)\cdot(+1)+(-1)\cdot(-1)=0
  • 向量 1 和 3:(+1)⋅(+1)+(+1)⋅(+1)+(−1)⋅(+1)+(−1)⋅(+1)=0(+1)\cdot(+1)+( +1)\cdot(+1)+(-1)\cdot(+1)+(-1)\cdot(+1)=0
  • 向量 1 和 4:(+1)⋅(+1)+(+1)⋅(−1)+(−1)⋅(−1)+(−1)⋅(+1)=0(+1)\cdot(+1)+( +1)\cdot(-1)+(-1)\cdot(-1)+(-1)\cdot(+1)=0
  • 向量 2 和 3:(+1)⋅(+1)+(−1)⋅(+1)+(+1)⋅(+1)+(−1)⋅(+1)=0(+1)\cdot(+1)+( -1)\cdot(+1)+( +1)\cdot(+1)+(-1)\cdot(+1)=0
  • 向量 2 和 4:(+1)⋅(+1)+(−1)⋅(−1)+(+1)⋅(−1)+(−1)⋅(+1)=0(+1)\cdot(+1)+( -1)\cdot(-1)+( +1)\cdot(-1)+(-1)\cdot(+1)=0
  • 向量 3 和 4:(+1)⋅(+1)+(+1)⋅(−1)+(+1)⋅(−1)+(+1)⋅(+1)=0(+1)\cdot(+1)+( +1)\cdot(-1)+( +1)\cdot(-1)+( +1)\cdot(+1)=0

输入解题思路,AI测评打分。不知道怎么写?

首页