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 ...
随机推荐
- 用html5自带表单验证 并且用ajax提交的解决方法(附例子)
用submit来提交表单,然后在js中监听submit方法,用ajax提交表单最后阻止submit的自动提交. 在标准浏览器中,阻止浏览器默认行为使用event.preventDefault(),而在 ...
- C++——绪论
计算机语言的发展 1.机器语言(二进制).汇编语言.比较难以理解和识记,与人类语言之间的差距太大: 2.高级语言,可以写出类似于人类思维的语句,可以有人们习惯的表达方式: 3.面向对象的语言,描述客观 ...
- c++面向对象 之 内联函数 this 静态成员
1,内联函数 如果一个函数是内联的,那么在编译时,编译器会把该函数的代码副本放置在每个调用该函数的地方.用inline指定,内联函数通常短小精悍没有while和for循环,能够帮助提升程序执行的速度 ...
- scw——02错误initializationError(Runner:JUnit 4)
代码: 错误: 原因:版本不同,自动生成的代码不同 解决:
- 密码学笔记-一段base64wp
CTF--练习平台 例题: 一段Base64 flag格式:flag{xxxxxxxxxxxxx} 附件: base64.txt 1.base64解码:http://base64.xpcha.com/ ...
- MySQL数据库 | 数据库和数据表的基本操作
第一篇博文,一个小小的纪念仪式^-^ 以下正文 一.数据库的基本操作 --数据库的操作 --连接数据库 mysql -uroot -p密码 mysql -uroot -pmysql --退出数据库 e ...
- PPT 素材大全
1.模板大全 2.三方辅助软件APP 3.PPT学习软件 www.presentationload.com dribble.com www.zcool.com.cn 4.其他功能
- 图的最短路径算法Dijkstra算法模板
Dijkstra算法:伪代码 //G为图,一般设为全局变量,数组d[u]为原点到达个点的额最短路径, s为起点 Dijkstra(G, d[u], s){ 初始化: for (循环n次){ u = 是 ...
- eli和字符串 (牛客假期训练)
链接:https://ac.nowcoder.com/acm/contest/3002/G来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言5242 ...
- schroeder reverb matlab实现
原理参考:Natural sounding artificial reverberation combFilter.m: function output = combFilter(delay, gai ...