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 ...
随机推荐
- 访问windows共享无法分配内存问题解决
设置:“HKLMSYSTEMCurrentControlSetControlSession ManagerMemory ManagementLargeSystemCache” 为 “1″ 设置:“HK ...
- [Luogu]中位数
Description Luogu1168 Solution 一种神奇的做法:开一个大根堆和小根堆,保证大根堆比小根堆多1个元素,且大根堆堆顶元素比小根堆堆顶元素小,那么大根堆堆顶就是中位数.插入的时 ...
- Python_函数进阶
楔子 假如有一个函数,实现返回两个数中的较大值: def my_max(x,y): m = x if x>y else y return mbigger = my_max(10,20)print ...
- axios中then不用第二个参数,最好用catch
一般来说,不要在then方法里面定义 Reject 状态的回调函数(即then的第二个参数),总是使用catch方法. // bad promise .then(function(data) { // ...
- hfs 文件存储
hfs 服务器上面的和本地拖上去的文件是同一个文件.对本地文件拖上去之后再修改,服务器文件也会修改.所以服务器要有一个自己的文件存放.
- object转为string
object为null时 错误:object.tostring() 空指针 正确:(string)object
- AcWing 908. 最大不相交区间数量
//1.将每个区间按右端点从小到大排序 //2.从前往后依次枚举每个区间,如果当前区间中已经包含点,就直接跳过,否则,选择当前区间的右端点 //选右端点的话,可以尽可能的包含在多个区间里 //那么选的 ...
- linux零碎001
glibc:GNU发布的libc库,即c运行库.glibc是linux系统中最底层的api,几乎其它任何运行库都会依赖于glibc. uclibc:是一个面向嵌入式Linux系统的小型的C标准库.最初 ...
- date时间比较
比较前先要对时间判断不能为空 int result = tk.getCloseTime().compareTo(tk.getPlanEndTime()); result = 1: 代表 closeT ...
- zk zkCli shell命令
查看zk 注册服务:在zk bin 下执行 sh zkCli.sh 计入客户端shell命令行 查看zk注册服务:ls / 或者递归查看 ls -s / 列出的为注册服务. 查询服务 ...