代码:
// Created by CAD on 2019/11/23.
#include <bits/stdc++.h>
using namespace std;
char a[105][105],res[105][105],f;
int t,r,c,k,cnt,w[105];
int main()
{
cin>>t;
while(t--)
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>r>>c>>k;
cnt=0;
for(int i=1;i<=r;++i)
{
for(int j=1;j<=c;++j)
cin>>a[i][j],cnt+=(a[i][j]=='R');
}
for(int i=1;i<=k;++i)
if(i<=cnt%k) w[i]=cnt/k+1;
else w[i]=cnt/k;
f='0';
for(int i=1,k=1;i<=r;++i)
{
for(int j=((i&1)?1:c);1<=j&&j<=c;j+=((i&1)?1:-1))
{
if(w[k]==0&&a[i][j]=='R')
{
f++,k++;
if(f=='9'+1) f='A';
if(f=='Z'+1) f='a';
}
res[i][j]=f;
w[k]-=(a[i][j]=='R');
}
res[i][c+1]=0;
cout<<res[i]+1<<endl;
}
}
}