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 ...
随机推荐
- MySQL中的find_in_set()函数使用技巧心得与应用场景总结
Author:极客小俊 一个专注于web技术的80后 我不用拼过聪明人,我只需要拼过那些懒人 我就一定会超越大部分人! CSDN@极客小俊,CSDN官方首发原创文章 企业博客 CSDN.com 个人博 ...
- Linux系统编程 —读写锁rwlock
读写锁是另一种实现线程间同步的方式.与互斥量类似,但读写锁将操作分为读.写两种方式,可以多个线程同时占用读模式的读写锁,这样使得读写锁具有更高的并行性. 读写锁的特性为:写独占,读共享:写锁优先级高. ...
- 适配器(adapter)与fragment之间、fragment与activity之间的通信问题
一.适配器(adapter)与fragment之间通信 通过本地广播进行通信 步骤如下 在adapter中代码 声明本地广播管理 private LocalBroadcastManager local ...
- #error: Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
转载:https://www.cnblogs.com/cvwyh/p/10570920.html 错误 在使用VS编译文件时出现了如下错误: #error: Building MFC applicat ...
- 头文件.h的作用
参考链接http://www.cnblogs.com/webcyz/archive/2012/09/16/2688035.html懒得复制过来
- Redash 二开 - 后端环境搭建
Redash 二开 - 后端环境搭建 一.操作系统选择 官方文档有一句话:Windows users: while it should be possible to run Redash on a W ...
- frp内网穿透
原理 frp(fast reverse proxy)分为Server端和Client端,Server端安装在带有公网IP的服务器上,Client安装在内网环境但能上网的普通PC中. 流程: Serve ...
- excel——VlookUp函数的使用
VlookUp函数,查询两个表中的相同字段数据,并将需要引用的数据从B表填充到A表 1.打开A表,将需要查询的列选中 在需要引用的列输入 = 在上方,函数选择中选择VLOOKUP函数 Windows: ...
- TP5本地运行正常,线上运行某页面出现【模板文件不存在】问题的解决办法
相信许多小伙伴和我一样,明明在本地运行页面一切正常,而到线上(本人是用的虚拟主机)出现了如下图的问题: 其实这个问题出现的原因很简单,就是我们开发是在windows 系统下,windows系统对大小写 ...
- mysql字段大小写敏感设置
mysql中varchar类型的字符集一般设置成utf8,然而mysql默认是对大小写不敏感(不区分),如果想要mysql区分大小写需要设置排序规则,规则详解如下:在mysql中存在着各种排序规则:1 ...