题目链接

题解

先把每个格子看做一个点 (所谓的切比雪夫距离的转化) ,然后把这些点组成的矩形旋转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. MGRE及实验

    tunnel 隧道:一种的简单的VPN技术: 普通的tunnel为点到点网络类型: 生成隧道接口,流量通过路由查询后,若通过隧道接口转发时,需要在原有的三层报头前,再添加一个公有地址间的报头: 将两个 ...

  2. vue 游戏手柄使用

    直接上代码. <template> <div class="home"> </div> </template> <script ...

  3. Salesforce LWC学习(二十六) 简单知识总结篇三

    首先本篇感谢长源edward老哥的大力帮助. 背景:我们在前端开发的时候,经常会用到输入框,并且对这个输入框设置 required或者其他的验证,当不满足条件时使用自定义的UI或者使用标准的 inpu ...

  4. Centos-统计文件或目录占用磁盘空间-du

    du 显示文件或目录所占磁盘空间总量 相关选项 -s 显示文件或者整个目录的大小,默认单位为KB -b 指定单位为byte -h     人类友好读方式显示 -m 指定单位为 MB

  5. Python-装饰器中保留被装饰函数元数据

     函数的元数据包括哪些呢? 1. 函数名 .__name__ 2. 函数注释 .__doc__ ... 那,如何保留被装饰函数元数据,通过wraps装饰器保留被装饰函数的元数据 import time ...

  6. 02 sublime text3下配置Python的编译运行环境

    内容参考如下文章,加入了自己的干货: https://www.cnblogs.com/huluwahaha/p/7503930.html 在sublime中如何配置Python的编译环境呢? 打开Su ...

  7. RHSA-2017:2473-重要: 内核 安全和BUG修复更新(需要重启、存在EXP、本地提权)

    [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 修复命令: 使用root账号登陆She ...

  8. protoc-c 安装记录

    记录下 protobuf-c 安装过程中的问题. 1) 安装的时候没细看依赖. --  protobuf-c requires a C compiler, a C++ compiler, protob ...

  9. ip地址和网络端口总结

    ip地址 ip地址默认指ipv4地址,用4个字节表示,转换为点分10进制,可以表达范围0.0.0.0到255.255.255.255的地址,大约为42.95亿个地址.互联网编号分配机构(IANA,In ...

  10. 最近集训的图论(思路+实现)题目汇总(内容包含tarjan、分层图、拓扑、差分、奇怪的最短路):

    (集训模拟赛2)抢掠计划(tarjan强) 题目:给你n个点,m条边的图,每个点有点权,有一些点是"酒吧"点,终点只能在"酒吧",起点给定,路可以重复经过,但点 ...