Codeforces Round #337 (Div. 2)C. Harmony Analysis
来源:互联网 发布:java数组的用法 编辑:程序博客网 时间:2024/05/16 12:36
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?
The only line of the input contains a single integer k (0 ≤ k ≤ 9).
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.
2
++**+*+*+++++**+
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
题意:求出2^k维的2^k个两两正交向量
/* ***********************************************Author : rycCreated Time : 2016-08-20 SaturdayFile Name : E:\acm\codeforces\337C.cppLanguage : c++Copyright 2016 ryc All Rights Reserved************************************************ */#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<cmath>#include<list>#include<queue>#include<vector>#include<stack>#include<map>using namespace std;typedef long long LL;typedef pair<int,int>pii;const int maxn=513;int num[maxn][maxn];void dabiao(){ num[1][1]=1; for(int k=1;k<=256;k<<=1){ for(int i=1;i<=k;++i){ for(int j=1;j<=k;++j){ num[i+k][j]=num[i][j+k]=num[i][j]; num[i+k][j+k]=!num[i][j]; } } }}int main(){ dabiao(); int n;cin>>n; for(int i=1;i<=1<<n;++i){ for(int j=1;j<=1<<n;++j){ if(num[i][j]){ printf("+"); } else { printf("*"); } } printf("\n"); } return 0;}
- Codeforces Round #337 (Div. 2) C Harmony Analysis
- Codeforces Round #337 (Div. 2) 610C Harmony Analysis(脑洞)
- *Codeforces Round #337 (Div. 2) C Harmony Analysis 构造题
- Codeforces Round #337 (Div. 2) C Harmony Analysis
- Codeforces Round #337 (Div. 2) C. Harmony Analysis (构造)
- Codeforces Round #337 (Div. 2)C. Harmony Analysis
- Codeforces Round #337 (Div. 2)-C. Harmony Analysis
- Codeforces Round #337 (Div. 2)-C Harmony Analysis(构造x维正交向量)
- Codeforces #337 (Div.2)C.Harmony Analysis【构造】
- Codeforces - 337C(div2) - Harmony Analysis(找规律)
- Codeforces 610C:Harmony Analysis 递归
- codeforces 610C Harmony Analysis 构造
- CodeForces 610 C. Harmony Analysis(构造)
- Codeforces 610C Harmony Analysis(构造)
- 【53.57%】【codeforces 610C】Harmony Analysis
- cf#-337 C. Harmony Analysis
- Harmony Analysis CodeForces
- Codeforces 453 B Little Pony and Harmony Chest(Round 259 div.1 B/div.2 D)
- The final summery of the 2016 summer camp
- Jenkins安装及使用(CentOS6.5)
- 《Docker Registry搭建过程及其使用说明》
- Java开发中的23种设计模式
- 欢迎使用CSDN-markdown编辑器
- Codeforces Round #337 (Div. 2)C. Harmony Analysis
- 多线程——引用同步函数解决经典储户银行存钱问题
- pycharm学习技巧 Learning tips
- S5PV210(TQ210)学习笔记——按键驱动程序
- java基础学习之时间监听--坦克
- 如何使用Hadoop的MultipleOutputs进行多文件输出
- 100天土鸡饲养计划(29)
- android基础-Apk打包
- 初学者之小甲鱼C++对象的介绍