Codeforces Round #601 (Div. 2)D(蛇形模拟)
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
vector<char>ans;
char a[][];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for(int i='';i<='';++i)
ans.emplace_back(i);
for(int i='A';i<='Z';++i)
ans.emplace_back(i);
for(int i='a';i<='z';++i)
ans.emplace_back(i);
int t;
cin>>t;
while(t--){
int r,c,k;
cin>>r>>c>>k;
int cnt=;
for(int i=;i<=r;++i)
for(int j=;j<=c;++j){
cin>>a[i][j];
if(a[i][j]=='R')
++cnt;
}
int x=cnt/k,y=cnt%k;
int pt=;
int tx=x;
if(y)
++tx,--y;
for(int i=;i<=r;++i){
if(i&){
for(int j=;j<=c;++j){
if(a[i][j]=='R')
--tx,--cnt;
a[i][j]=ans[pt];
if(!cnt)
continue;
if(!tx){
++pt;
if(y)
tx=x+,--y;
else
tx=x;
}
}
}
else{
for(int j=c;j>=;--j){
if(a[i][j]=='R')
--tx,--cnt;
a[i][j]=ans[pt];
if(!cnt)
continue;
if(!tx){
++pt;
if(y)
tx=x+,--y;
else
tx=x;
}
}
}
}
for(int i=;i<=r;++i){
for(int j=;j<=c;++j)
cout<<a[i][j];
cout<<"\n";
}
}
return ;
}
Codeforces Round #601 (Div. 2)D(蛇形模拟)的更多相关文章
- 【cf比赛记录】Codeforces Round #601 (Div. 2)
Codeforces Round #601 (Div. 2) ---- 比赛传送门 周二晚因为身体不适鸽了,补题补题 A // http://codeforces.com/contest/1255/p ...
- Codeforces Round #301 (Div. 2)(A,【模拟】B,【贪心构造】C,【DFS】)
A. Combination Lock time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
- Codeforces Round #345 (Div. 2)【A.模拟,B,暴力,C,STL,容斥原理】
A. Joysticks time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...
- Codeforces Round #543 (Div. 2) D 双指针 + 模拟
https://codeforces.com/contest/1121/problem/D 题意 给你一个m(<=5e5)个数的序列,选择删除某些数,使得剩下的数按每组k个数以此分成n组(n*k ...
- Codeforces Round #398 (Div. 2) A. Snacktower 模拟
A. Snacktower 题目连接: http://codeforces.com/contest/767/problem/A Description According to an old lege ...
- Codeforces Round #601 (Div. 2)
传送门 A. Changing Volume 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/19 22:37:33 */ #include ...
- Codeforces Round #237 (Div. 2) B题模拟题
链接:http://codeforces.com/contest/404/problem/B B. Marathon time limit per test 1 second memory limit ...
- Codeforces Round #371 (Div. 2) C 大模拟
http://codeforces.com/contest/714/problem/C 题目大意:有t个询问,每个询问有三种操作 ①加入一个数值为a[i]的数字 ②消除一个数值为a[i]的数字 ③给一 ...
- Codeforces Round #436 (Div. 2)C. Bus 模拟
C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input out ...
随机推荐
- C++-标准模板库
C++较之C语言强大的功能之一是,C++编译器自带了大量的可复用代码库,我们称为标准模板库(standard template library),STL.标准模板库是一套常用的数据结构的集合,包括链表 ...
- js时间相关操作
取值 this.divEndDate.attr("value",new Date()); var date = new Date(); date.getYear(): 取2 ...
- 番外:如何克隆可刷新的PDB(Refreshable PDB)
基于版本:19c (12.2.0.3) AskScuti 创建方法:克隆创建 对应路径:属于克隆.PDB类型为:Refreshable 相关系列请参考<Oracle创建PDB列表文章> 注 ...
- python3练习100题——027
又是一道迭代的题,没做好. 看了答案才试着写出来. 我一定要加油啊,为了尽快摆脱现在讨厌的生活! 原题链接:http://www.runoob.com/python/python-exercise-e ...
- HTTP状态码的浪漫故事
小明是一个程序员,经常加班,在一个和尚部门,一个妹子都没有,所以一直单身. 404(Not Found):服务器无法根据客户端的请求找到资源(网页) 过年回家,老爸老妈给门开一条缝,先看看小明身后-- ...
- python logging 总结
基本用法: import sys # 获取logger实例,如果参数为空则返回root logger logger = logging.getLogger("AppName" ...
- 钉钉内网穿透工具在windows的使用。
钉钉内网穿透工具在windows环境下使用 1.WIN+R,然后cmd,调出dos控制台 2.进入内网穿透程序ding.exe所在目录 3.执行 ./ding.exe -config=ding.cfg ...
- 【原】AMFObject数据格式详解
AMF AMF是Action Message Format(动作消息格式)的简写,它是一种二进制的数据格式.它的设计是为了把actionscript里面的数据(包括Object, Array, Boo ...
- FIR滤波器工作原理(算法)以及verilog算法实现(包含与IIR的一些对比)
滤波器在2017年IC前端的笔试中,出现频率十分的高.不论今后是否会涉及,还是要记住一些会比较好.接下来就将从这四个方面来讲解,FIR数字滤波器的工作原理(算法)与verilog实现. ·什么是FIR ...
- XML学习笔记1
一.XML与HTML的差异 XML 不是 HTML 的替代:XML 和 HTML 为不同的目的而设计: XML 被设计用来传输和存储数据,其焦点是数据的内容: HTML 被设计用来显示数据,其焦点是数 ...