C. Harmony Analysis

题目连接:

http://www.codeforces.com/contest/610/problem/C

Description

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.

Sample Input

2

Sample Output

++**

++

++++

+**+

Hint

题意

要求你构造出2n个2n维向量,使得向量之间两两相乘都等于0

题解:

瞎构造的。。。

大概证明可以由数学归纳法证明

假设我现在已经构造出了

a

那么我就可以构造出

a a

a -a

然后一直重复就好了。。。

代码

#include<bits/stdc++.h>
using namespace std; int dp[1200][1200];
int n;
int main()
{
scanf("%d",&n);
dp[0][0]=1;
for(int x=1;x<=n;x++)
{
for(int i=0;i<(1<<x-1);i++)
{
for(int j=0;j<(1<<x-1);j++)
{
dp[i][j+(1<<x-1)]=dp[i][j];
dp[i+(1<<x-1)][j]=dp[i][j];
dp[i+(1<<x-1)][j+(1<<x-1)]=1-dp[i][j];
}
}
}
for(int i=0;i<(1<<n);i++)
{
for(int j=0;j<(1<<n);j++)
{
if(dp[i][j])printf("+");
else printf("*");
}
printf("\n");
}
return 0;
}

Codeforces Round #337 (Div. 2) C. Harmony Analysis 构造的更多相关文章

  1. Codeforces Round #337 (Div. 2) C. Harmony Analysis 数学

    C. Harmony Analysis   The semester is already ending, so Danil made an effort and decided to visit a ...

  2. Codeforces Round #337 (Div. 2) 610C Harmony Analysis(脑洞)

    C. Harmony Analysis time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #337 (Div. 2) C. Harmony Analysis

    题目链接:http://codeforces.com/contest/610/problem/C 解题思路: 将后一个矩阵拆分为四个前一状态矩阵,其中三个与前一状态相同,剩下一个直接取反就行.还有很多 ...

  4. Codeforces Round #275 (Div. 1)A. Diverse Permutation 构造

    Codeforces Round #275 (Div. 1)A. Diverse Permutation Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 ht ...

  5. Codeforces Round #337 (Div. 2)

    水 A - Pasha and Stick #include <bits/stdc++.h> using namespace std; typedef long long ll; cons ...

  6. Codeforces Round #337 (Div. 2) D. Vika and Segments 线段树扫描线

    D. Vika and Segments 题目连接: http://www.codeforces.com/contest/610/problem/D Description Vika has an i ...

  7. Codeforces Round #337 (Div. 2) B. Vika and Squares 贪心

    B. Vika and Squares 题目连接: http://www.codeforces.com/contest/610/problem/B Description Vika has n jar ...

  8. Codeforces Round #337 (Div. 2) A. Pasha and Stick 数学

    A. Pasha and Stick 题目连接: http://www.codeforces.com/contest/610/problem/A Description Pasha has a woo ...

  9. Codeforces Round #337 (Div. 2) D. Vika and Segments (线段树+扫描线+离散化)

    题目链接:http://codeforces.com/contest/610/problem/D 就是给你宽度为1的n个线段,然你求总共有多少单位的长度. 相当于用线段树求面积并,只不过宽为1,注意y ...

随机推荐

  1. simpletest:一个简单的PHP试工具

    1. 下载: http://simpletest.org/ .2. 下载后,只要测试文件中包含如下两个文件,就可以用了 : <?php require_once('simpletest/auto ...

  2. 第三次阅读赵炯博士的《linux内核代码完全注释》:序

    这是我第三次阅读linux内核代码完全注释了,当然前两次也没有读完,第一次读到第五章,第二次第七章. 所以说,赵炯博士对我最大的帮助时介绍了intel386的结构,以及内核编程的方法. 至于真正的内核 ...

  3. Jquery 遍历表单 AJAX提交

    function test(){ var arrayObj = new Array(); $("#contentTable tbody tr").each(function(){ ...

  4. Yarn中的几种状态机

    1 概述 为了增大并发性,Yarn采用事件驱动的并发模型,将各种处理逻辑抽象成事件和调度器,将事件的处理过程用状态机表示.什么是状态机? 如果一个对象,其构成为若干个状态,以及触发这些状态发生相互转移 ...

  5. (原创)jquery插件-可选可填控件

    ;(function ($) { $.fn.autoFillTextBox = function (options) { var defaults = { nShow: 5, //显示条数 nLen: ...

  6. Ubuntu14.04上安装pip的方法

    在Ubuntu14.04上,建议通过下面的方法安装,这是一种通用的方法,也适用于Windows,当然在Windows下 手动下载下来就行了 wget https://bootstrap.pypa.io ...

  7. Django 1.6 最佳实践: django项目的服务器自动化部署(转)

    原文:http://www.weiguda.com/blog/41/ 当我们设置服务器时, 不应该每次都使用ssh登录服务器, 再按照记忆一步一步的配置. 因为这样实在是太容易忘记某些步骤了. 服务器 ...

  8. Clean Code第二章<命名>

    1.命名要有意义 错误写法 正确写法 2.某些构造函数可以提供有意义的静态方法去实现

  9. 读取proc信息的可扩展实现

    需求 1. 将内存.线程数等信息注册到zk上进行监控 2. 统计信息,为下一步做负载均衡做准备. 实现 本文只解决问题1. 从网上查询了下,这些信息可以从proc文件系统中获取,如果不知道proc的, ...

  10. V7承保 bug代码

    v7 bug1