AT3557 Four Coloring
题目链接
题解
先把每个格子看做一个点 (所谓的切比雪夫距离的转化) ,然后把这些点组成的矩形旋转45度,再把他塞到一个每个格子大小为\(d*d\)的网格图中,那么在一个格子上的点颜色相同
代码
#include<bits/stdc++.h>
using namespace std;
#define re register
#define ll long long
#define in inline
#define get getchar()
in int read()
{
int t=0; char ch=get;
while(ch<'0' || ch>'9') ch=get;
while(ch<='9' && ch>='0') t=t*10+ch-'0', ch=get;
return t;
}
int h,w,d;
char s[4]={'R','Y','G','B'};
int main()
{
h=read();
w=read();
d=read();
for(re int i=1;i<=h;i++){
for(re int j=1;j<=w;j++)
{
int x=(i+j+w)/d,y=(i-j+w)/d;
//cout<<x<<' '<<y<<endl;
cout<<s[(x%2)*2+y%2];
}
cout<<endl;
}
}
AT3557 Four Coloring的更多相关文章
- Codeforces Round #369 (Div. 2)---C - Coloring Trees (很妙的DP题)
题目链接 http://codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has a ...
- CF149D. Coloring Brackets[区间DP !]
题意:给括号匹配涂色,红色蓝色或不涂,要求见原题,求方案数 区间DP 用栈先处理匹配 f[i][j][0/1/2][0/1/2]表示i到ji涂色和j涂色的方案数 l和r匹配的话,转移到(l+1,r-1 ...
- Codeforces Round #369 (Div. 2) C. Coloring Trees DP
C. Coloring Trees ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the pa ...
- CodeForces #369 C. Coloring Trees DP
题目链接:C. Coloring Trees 题意:给出n棵树的颜色,有些树被染了,有些没有.现在让你把没被染色的树染色.使得beauty = k.问,最少使用的颜料是多少. K:连续的颜色为一组 ...
- CodeForces 149D Coloring Brackets
Coloring Brackets time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...
- C. Coloring Trees DP
传送门:http://codeforces.com/problemset/problem/711/C 题目: C. Coloring Trees time limit per test 2 secon ...
- codeforces 711C C. Coloring Trees(dp)
题目链接: C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- POJ 1419 Graph Coloring(最大独立集/补图的最大团)
Graph Coloring Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4893 Accepted: 2271 ...
- URAL 1080 Map Coloring(染色)
Map Coloring Time limit: 1.0 secondMemory limit: 64 MB We consider a geographical map with N countri ...
随机推荐
- Ansys Student 2020R2中Fluent编译UDF简介
使用内建编译器 在Ansys Fluent中编译UDF一般都需要额外安装相应版本的Visual Studio编译器,VS的缺点是体量大,占空间,安装后还需要额外进行相关设置才能正常使用.而新版本的An ...
- Ubuntu部署和体验Nexus3
关于Nexus 如下图,在局域网部署了Nexus之后,可以缓存中央仓库的jar,开发者开发的二方库发布到Nexus上,局域网内的其他人也可以从Nexus下载这些二方库使用: 环境信息 本次实战是在Li ...
- .Net Core 2.2 存取Cookie
第一步(注释代码):注释Startup.cs中 ConfigureServices 函数中的 options.CheckConsentNeeded = context => true; 第二步 ...
- C++ | 继承(基类,父类,超类),(派生类,子类)
转载:https://blog.csdn.net/Sherlock_Homles/article/details/82927515 文章参考:https://blog.csdn.net/war1111 ...
- Example Code for a TMP102 I2c Thermometer————Arduino
参考:https://playground.arduino.cc/Code/TMP102/ Example Code for a TMP102 I2c Thermometer I've fairly ...
- 谈谈InnoDB中的B+树索引
索引类似于书的目录,他是帮助我们从大量数据中快速定位某一条或者某个范围数据的一种数据结构.有序数组,搜索树都可以被用作索引.MySQL中有三大索引,分别是B+树索引.Hash索引.全文索引.B+树索引 ...
- 超级简单的照片画廊MVC
下载Gallery.zip - 23.5 MB 介绍 我想在我的个人网站上添加一个简单的图片库,但找不到任何合适的方法来从文件夹而不是数据库中挑选图片.也许我应该看得更仔细些!尽管如此,下面是我实现的 ...
- 扩展、接管MVC都不会,还会用Spring Boot?
持续原创输出,点击上方蓝字关注我 目录 前言 Spring Boot 版本 如何扩展MVC? 如何自定义一个拦截器? 什么都不配置为什么依然能运行MVC相关的功能? 如何全面接管MVC?[不推荐] 为 ...
- 使用Python对植物大战僵尸学习研究
根据上一篇 使用Python读写游戏1 中,使用Python win32库,对一款游戏进行了读内存 操作. 今天来写一下对内存进行写的操作 正文 要进行32位的读写,首先了解一下要用到的几个函数,通过 ...
- day01 Pyhton学习
一.python介绍 python是一种解释型.弱类型的高级编程语言. 编译型:是把源程序的每一条语言编译成机器语言,并保存成二进制文件,给计算机执行,运算速度快. 优点:程序执行效率高,可以脱离语言 ...