Start: Jan, 04, 2017 19:40:00
2016年秋季学期程序设计基础期末考试
End: Jan, 04, 2017 21:40:00
Time elapsed:
Time remaining:

Problem_ID: G
Result: Accepted
Time: 224ms
Memory: 2568kB
Author: fyk19980409
In contest: 1084

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long ll;
struct node
{
	char nam[100];
	int c;
}cord[100];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,m;
		scanf("%d %d",&n,&m);
		char a[1000][1000];
		for(int i=0;i<n;i++)
		{
				scanf("%s",a[i]);
		}
		int q;
		scanf("%d",&q);
		for(int i=0;i<q;i++)
		{
			int x,y,z;
			scanf("%d %d %d",&x,&y,&z);
			z%=26;
			if(a[x][y]+z>'z')
			{
				a[x][y]=a[x][y]+z-26;
			}else if(a[x][y]+z<'a')
			{
				a[x][y]=a[x][y]+z+26;
			}else
			{
				a[x][y]=a[x][y]+z;
			}
		}
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				printf("%c",a[i][j]);
			}
			printf("\n");
		}
	}
}