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 ...
随机推荐
- SDP服务搜索流程源码分析
BREDR的设备 在进行配对完成之后,进行;连接之前都要进行服务的搜索,服务搜索走的流程是SDP,这篇文章就分析一下,bluedroid中SDP的代码流程,我们从配对完成的回调函数开始分析: /*** ...
- Pandas简易入门(一)
目录: 读取数据 索引 选择数据 简单运算 声明,本文引用于:https://www.dataquest.io/mission/8/introduction-to-pandas (建议阅读原文) Pa ...
- item 3: 理解decltype
本文翻译自modern effective C++,由于水平有限,故无法保证翻译完全正确,欢迎指出错误.谢谢! 博客已经迁移到这里啦 decltype是一个奇怪的东西.给出一个名字或者一个表达式,de ...
- Flask-sqlalchemy 语法总结
Flask-sqlalchemy 语法总结 ** DDLdb.create_all() :创建实体表db.drop_all(): 删除表 1)插入表Db.session.add(user) #user ...
- flask_admin 笔记七 扩展功能
高级功能 1,开启CSRF保护 要将CSRF保护添加到由ModelView实例生成的表单中,请通过指定form_base_class参数在ModelView子类中使用SecureForm类: from ...
- ant+Jacoco 统计tomcat远程部署后项目接口自动化测试或者功能测试代码覆盖率
1.安装ant 环境,https://ant.apache.org/bindownload.cgi 2.下载jacoco包 https://www.eclemma.org/jacoco/ ,解压后, ...
- Vue2.0 搭配 axios
1.安装axios $ npm install axios 2.Demo (1)Get // 为给定 ID 的 user 创建请求 axios.get('/user?ID=12345') .then( ...
- Docker网络解决方案 - Calico部署记录
简单来说,实现docker跨主机容器间通信,常用的第三方网络方案是Flannel,Weave,Calico:Flannel会为每个host分配一个subnet,容器从这个subnet中分配ip,这些i ...
- js方法中拼接html时点击事件中拼接字符串参数
1,代码 var html = '<a href="#" onclick="tableDelete(\''+ row.labelid +'\')"> ...
- Comparison of Static Code Analysis Tools for Java
http://www.sw-engineering-candies.com/blog-1/comparison-of-findbugs-pmd-and-checkstyle https://stack ...