Asa's Website

B - Print a Frame

cpaojitp1

最終更新日

Table of Contents

Loading...

問題

https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/5/ITP1_5_B

問題文

たて HH x よこ WW の枠を書いてね。
H=W=0H = W = 0 なら終了。

制約

サンプル

I/O 1

3 4 5 6 3 3 0 0
#### #..# #### ###### #....# #....# #....# ###### ### #.# ###

考察

やるだけ。

コード

https://onlinejudge.u-aizu.ac.jp/status/users/a01sa01to/submissions/1/ITP1_5_B/judge/6370451/C++17

int main() { while (true) { int h, w; cin >> h >> w; if (h == 0 && w == 0) break; rep(i, h) { if (i == 0 || i == h - 1) { rep(j, w) cout << "#"; } else { cout << "#"; rep(j, w - 2) cout << "."; cout << "#"; } cout << endl; } cout << endl; } }