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 ...
随机推荐
- JavaWeb学习总结-12 JSTL标签语言
一 JSTL JSP标准标签库(JSTL)是一个JSP标签集合,它封装了JSP应用的通用核心功能. JSTL支持通用的.结构化的任务,比如迭代,条件判断,XML文档操作,国际化标签,SQL标签. 除了 ...
- LOJ2803 CCC2018 平衡树 数论分块、记忆化搜索
传送门 题意差评,其实就是一个递推式:\(f_1 = 1 , f_i = \sum\limits_{j=2}^i f_{\lfloor \frac{i}{j} \rfloor}\),然后求\(f_N\ ...
- thymeleaf参考手册
1.创建 html <!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"></html&g ...
- 从一些代码方法中,去学习C#委托
先来看看下面一个类中的一些方法: class Bc { public double Add(double number1, double number2) { return number1 + num ...
- flask多app和栈的应用
一.简介 flask的蓝图可以实现url的分发,当有多个app时也可以利用app进行url分发,这里介绍下使用方式和内部原理以及栈的应用. 二.多app使用 使用示例 from werkzeu ...
- 如何看待P2P领域的羊毛党?
本文来自网易云社区 不利:不利的影响应该是显而易见的,前面的题主也有解释过.总结来说,不利的影响主要是两点: a. 对平台毛利和资金的损害.一般来说,优惠活动本是一个用户只能享用一次,但如果注册多个账 ...
- 使用ajax方法实现form表单的提交
作者:13 GitHub:https://github.com/ZHENFENG13 版权声明:本文为原创文章,未经允许不得转载. 写在前面的话 在使用form表单的时候,一旦点击提交触发submit ...
- JAVA CAS原理浅谈
java.util.concurrent包完全建立在CAS之上的,没有CAS就不会有此包.可见CAS的重要性. CAS CAS:Compare and Swap, 翻译成比较并交换. java.uti ...
- Slurm任务调度系统部署和测试(源码)(1)
1. 概述1.1 节点信息2. 节点准备3. 部署NTP服务器4. 部署LDAP服务器5. 部署Munge认证服务6. 部署Mysql数据库服务7. 部署slurm7.1 创建slurm用户7.2 挂 ...
- 第三次作业(1) Visual Studio程序安装过程和练习过程
Visual Studio程序安装过程和练习过程 第一步 首先要在网上找一个VS2013的安装包,之后我安装在D盘上,C盘上也需要有5.2G空间,勾选相应的选项,才能继续安装. 安装的过程很漫长,接近 ...