题目链接

题解

先把每个格子看做一个点 (所谓的切比雪夫距离的转化) ,然后把这些点组成的矩形旋转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的更多相关文章

  1. 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 ...

  2. CF149D. Coloring Brackets[区间DP !]

    题意:给括号匹配涂色,红色蓝色或不涂,要求见原题,求方案数 区间DP 用栈先处理匹配 f[i][j][0/1/2][0/1/2]表示i到ji涂色和j涂色的方案数 l和r匹配的话,转移到(l+1,r-1 ...

  3. 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 ...

  4. CodeForces #369 C. Coloring Trees DP

    题目链接:C. Coloring Trees 题意:给出n棵树的颜色,有些树被染了,有些没有.现在让你把没被染色的树染色.使得beauty = k.问,最少使用的颜料是多少.   K:连续的颜色为一组 ...

  5. CodeForces 149D Coloring Brackets

    Coloring Brackets time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...

  6. C. Coloring Trees DP

    传送门:http://codeforces.com/problemset/problem/711/C 题目: C. Coloring Trees time limit per test 2 secon ...

  7. codeforces 711C C. Coloring Trees(dp)

    题目链接: C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  8. POJ 1419 Graph Coloring(最大独立集/补图的最大团)

    Graph Coloring Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4893   Accepted: 2271   ...

  9. URAL 1080 Map Coloring(染色)

    Map Coloring Time limit: 1.0 secondMemory limit: 64 MB We consider a geographical map with N countri ...

随机推荐

  1. PuTTY 连接 linux 服务器执行 make menuconfig 乱码问题解决

    PuTTY 连接 linux 服务器执行 make menuconfig 时可能出现乱码,如下图所示: 有两个方法解决这个问题: 方法一: 修改 PuTTY 配置如下图所示: 方法二: 在 -/.ba ...

  2. 对于filter的理解

    filter语法:使用filter会创建一个新数组,所以原数组不变 array.filter(function(value,index,arr), thisValue) 其中:arr:数组(可选) i ...

  3. MySQL触发器初试:当A表插入新记录,自动在B表中插入相同ID的记录

    今天第一次用MySQL的触发器,怕忘了,赶紧写篇博客记录一下. 废话不说,先上语法: 1 CREATE TRIGGER trigger_name 2 { BEFORE | AFTER } { INSE ...

  4. 学习git这一篇就够了!!!

    git命令操作 本地库操作 初始化本地仓库 初始化命令 git init $ work % cd workspace $ workspace % mkdir WebService //创建文件夹 $ ...

  5. Linux下彻底删除安装的rpm包

    如何彻底Linux系统下安装的rpm包?现以mySQL为例进行介绍: 一.使用以下命令查看mysql安装情况 [root@xpq mysql]# rpm -qa|grep -i mysql MySQL ...

  6. weblogic 安装+部署(一)

    昨天刚接触weblogic,在windows下搭建了一个weblogic,没什么技术,留个笔记. 1.首先要有jdk,添加环境变量这个没什么好说的. 2.下载weblogic:可以去官网下:http: ...

  7. 批处理文件的@echo off

    转载:https://blog.csdn.net/zl1zl2zl3/article/details/79218448  @echo off  关闭回显     @echo on  打开回显      ...

  8. JVM 常见线上问题 → CPU 100%、内存泄露 问题排查

    开心一刻 明明是个小 bug,但就是死活修不好,我特么心态崩了...... 前言 后文会从 Windows.Linux 两个系统来做示例展示,有人会有疑问了:为什么要说 Windows 版的 ? 目前 ...

  9. apline无法向gitlab上传git lfs问题

    1 背景 在k8s中基于alpine做底层系统的容器进行git lfs push操作时,发现报错无法上传成功 Fatal error: Server error: http://git.ops.xxx ...

  10. nrf528xx bootloader 模块介绍

    1. bootloader 的基本功能: 启动应用 几个应用之间切换 初始化外设 nordic nrf52xxx的bootloader主要功能用来做DFU, 可以通过HCI, UART 或BLE通信的 ...