C. Harmony Analysis
 

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 test(s)
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,构造2^k * 2^k的图,  使得任意两行 相乘相加值为0

题解:对于一个  满足了条件的 正方形,想要得到将其边长翻倍的图形  我们将它复制接右边,接到正下方,再取反接到斜对角,就是了;

    根据这个我们从1*1得到  2*2得到 4*4---到答案

//meek///#include<bits/stdc++.h>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include<iostream>
#include<bitset>
#include<vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std ;
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define fi first
#define se second
#define MP make_pair
typedef long long ll; const int N = ;
const int M = ;
const int inf = 0x3f3f3f3f;
const int MOD = ;
const double eps = 0.000001; int a[N][N],n;
int main() {
scanf("%d",&n);
a[][]=;
for(int x=;x<=n;x++) {
for(int i=;i<(<<x-);i++) {
for(int j=;j<(<<x-);j++) {
a[i][j+(<<x-)]=a[i][j];
a[i+(<<x-)][j]=a[i][j];
a[i+(<<x-)][j+(<<x-)]=-a[i][j];
}
}
}
for(int i=;i<(<<n);i++) {
for(int j=;j<(<<n);j++) {
if(a[i][j])printf("+");
else printf("*");
}
printf("\n");
}
return ;
}

代码

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

  1. Codeforces Round #337 (Div. 2) C. Harmony Analysis 构造

    C. Harmony Analysis 题目连接: http://www.codeforces.com/contest/610/problem/C Description The semester i ...

  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 #337 (Div. 2)

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

  5. 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 ...

  6. 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 ...

  7. 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 ...

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

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

  9. Codeforces Round #337 (Div. 2) D. Vika and Segments 线段树 矩阵面积并

    D. Vika and Segments     Vika has an infinite sheet of squared paper. Initially all squares are whit ...

随机推荐

  1. C#.Net 图片处理大全

    C# How to: Image filtering by directly manipulating Pixel ARGB values C# How to: Image filtering imp ...

  2. 在WIN7下安装运行mongodb 1)、下载MongoDB

    1).下载MongoDB http://downloads.mongodb.org/win32/mongodb-win32-i386-2.4.5.zip 下载Windows 32-bit版本并解压缩, ...

  3. 关于ios极光推送server端注意的地方

    今天试用了极光推送API 用它是因为,大多数人说它的文档是最全的,但是用过之后,发现关于IOS的文档,还是很不够,导致走了一点弯路! 特别是服务端的代码:https://github.com/jpus ...

  4. [转]强悍的跨平台开源多媒体中心XBMC介绍

    [转]强悍的跨平台开源多媒体中心XBMC介绍 http://www.cnblogs.com/mythou/p/3220898.html 最近都在了解Android下的音视频,因为最近需要做一个多媒体中 ...

  5. flask页面中Head标签内容为空问题

    在使用flask时遇到点问题,以前还没有注意到. 生成页面的时候使用的是模板继承方式,当添加meta标题的时候,本来是添加的base.html模板中的head标签中,但是生成页面后,head中的内容却 ...

  6. MVC3+中 ViewBag、ViewData和TempData的使用和区别

    在MVC3开始,视图数据可以通过ViewBag属性访问,在MVC2中则是使用ViewData.MVC3中保留了ViewData的使用.ViewBag 是动态类型(dynamic),ViewData 是 ...

  7. ubuntu中安装Rstdio无法切换中文输入法

    安装了RStudio,发现没法切换出中文输入法,搜索了一下 具体参考这里:https://support.rstudio.com/hc/en-us/articles/205605748-Using-R ...

  8. homework-07 C++ 11 能好怎

    大二时候学过c++,但是那只是为了考试在学习,大作业也就写了一个读写者线程同步的模拟,连一个完整的类都没有写过,所以我必须承认对c++了解的很少. 对于C++ 11这一新标准,我首先阅读了来自前C++ ...

  9. python 可变参数

    原文地址:http://docs.pythontab.com/python/python3.4/controlflow.html#tut-functions 一个最不常用的选择是可以让函数调用可变个数 ...

  10. Window.document对象(2)

    四.操作样式 首先利用元素的ID找到该元素,存于一个变量中: var a = document.getElementById("id"): 然后可以对该元素的属性进行操作: a.s ...