#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int H,W; while(1){ cin >> H >> W; if(H==0&&W==0)break; for(int h=0;h<H;h++){ if(h==0||h==H-1){ for(int w=0;w<W;w++){ if(w==W-1) cout << "#" << endl; else cout << "#"; } } else { for(int w=0;w<W;w++){ if(w==0) cout << "#"; else if(w==W-1) cout << "#" << endl; else cout << "."; } } } cout << endl; } return 0; }
よくわからんバグになってもっかいそのまま書きなおしたら直った。
インデントで意味的ブロックわかりやすくするの大事ですね