Codeforces Round #337 (Div. 2) C. Harmony Analysis
题目链接:http://codeforces.com/contest/610/problem/C
解题思路:
将后一个矩阵拆分为四个前一状态矩阵,其中三个与前一状态相同,剩下一个直接取反就行。还有很多种取法,这种比较方便就是。
实现代码:
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int a[][],b[][];
int main()
{
int n;
cin>>n;
int k = ,t1=,t0=,i,j;
while(k<=n){
k++; t1=<<(k); t0=<<(k-);
b[][] = ;
for(i=;i<=t0;i++)
for(j=;j<=t0;j++)
b[i][j] = b[t0+i][j]=b[i][j+t0]=a[i][j];
for(i=;i<=t0;i++)
for(j=;j<=t0;j++)
b[i+t0][j+t0]= - a[i][j];
for(i=;i<=t1;i++)
for(j=;j<=t1;j++)
a[i][j] = b[i][j]; }
for(i=;i<=(<<n);i++){
for(j=;j<=(<<n);j++){
if(a[i][j]==)
cout<<"+";
else cout<<"*";
}
cout<<endl;
}
return ;
}
Codeforces Round #337 (Div. 2) C. Harmony Analysis的更多相关文章
- Codeforces Round #337 (Div. 2) C. Harmony Analysis 构造
C. Harmony Analysis 题目连接: http://www.codeforces.com/contest/610/problem/C Description The semester i ...
- 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 ...
- 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 ...
- Codeforces Round #337 (Div. 2)
水 A - Pasha and Stick #include <bits/stdc++.h> using namespace std; typedef long long ll; cons ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #337 (Div. 2) D. Vika and Segments (线段树+扫描线+离散化)
题目链接:http://codeforces.com/contest/610/problem/D 就是给你宽度为1的n个线段,然你求总共有多少单位的长度. 相当于用线段树求面积并,只不过宽为1,注意y ...
- 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 ...
随机推荐
- 解析LED发光效率
解析LED发光效率 来源:--作者:--浏览:532时间:2016-08-10 14:18 关键词: 发光效率为评测光源效率的指标,用光源发出的光通量 (lm)与向光源输入的电力(W)之比表示.单位为 ...
- CF915G Coprime Arrays 莫比乌斯反演、差分、前缀和
传送门 差分是真心人类智慧--完全不会 这么经典的式子肯定考虑莫比乌斯反演,不难得到\(b_k = \sum\limits_{i=1}^k \mu(i) \lfloor\frac{k}{i} \rfl ...
- LinqPad的变量比较功能
LinqPad是一个非常方便的C#工具(有免费版和收费版). 今天发现它的变量比较功能真是方便啊.且看3行代码产生如下结果: 说明:图中两个变量的成员属性值分别用红色和绿色背景标注:图很长,只截取了一 ...
- Flask源码解读--所有可扩展点
一.前言 flask中有很多可扩展点(笔者这样称呼),其中包含了信号和请求钩子,这些信号和钩子有什么用呢?其主要作用用于帮助我们进行程序的耦合性,当然还可以让我们自定义一些行为.话不多说,通过阅读源码 ...
- nginx location url解析过程
- 线程中join()的用法
Thread中,join()方法的作用是调用线程等待该线程完成后,才能继续用下运行. public static void main(String[] args) throws Interrupted ...
- python语言程序设计3
1, 起码坚持每天 半小时吧... 2, 上面有常用的几个数据类型..整数类型和字符串类型还行,但是列表类型的话就很蛋疼了. 3, 字符串类型的显著特点是在两侧有单引号或者双引号.用单引号和双引号表 ...
- 使用Hexo+Github搭建属于自己的博客(基础)
前言 hexo是一个台湾人做的基于Node.js的静态博客程序,优势是生成静态文件的速度非常快,支持markdown, 我最终选定它的原因是它速度快而且不容易出错,并且可以一键部署到github或者其 ...
- split-brain 脑裂问题(Keepalived)
脑裂(split-brain)指在一个高可用(HA)系统中,当联系着的两个节点断开联系时,本来为一个整体的系统,分裂为两个独立节点,这时两个节点开始争抢共享资源,结果会导致系统混乱,数据损坏.对于无状 ...
- nginx日志格式字段
Nginx日志主要分为两种:访问日志和错误日志.日志开关在Nginx配置文件(/etc/nginx/nginx.conf)中设置,两种日志都可以选择性关闭,默认都是打开的. 访问日志 访问日志主要记录 ...