B - ASCII Art
题目大意
给定一个 H×WH 的矩阵 A,仅包含整数 0∼26。第 i 行第 j 列的元素为 Ai,j。打印一个 H×W 的字符画,如果 Ai,j为 0 就在 第 i 行第 j 列打印 ,否则打印第从 A 开始的第 Ai,j个大写英文字母。
解题思路
没啥好讲的
代码
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int h, w;
cin >> h >> w;
for(int i = 1; i <= h; i++){
for(int j = 1; j <= w; j++){
int x;
cin >> x;
if(x==0) cout << ".";
else cout << char(x+'A'-1);//转换成子母(不要忘记-1)
}
cout << "\n";
}
return 0;
}