AT_abc452_b 题解
题目大意
给定一个 # 表示),其余部分涂成白色(用 . 表示)。输出涂好色的网格。
做法
设记录网格的数组为
代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
int h,w;
char wg[20][20];
signed main(){
cin>>h>>w;
for(int i=1;i<=h;i++)
for(int j=1;j<=w;j++)
wg[i][j]='.';//先初始化为白色
for(int i=1;i<=h;i++)
wg[i][1]=wg[i][w]='#';//遍历i
for(int i=1;i<=w;i++)
wg[1][i]=wg[h][i]='#';//遍历j
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++)
cout<<wg[i][j];//输出
cout<<'\n';
}
return 0;
}