10013 - Print a Frame
#include <iostream> using namespace std; void Slove(int h, int w) { for (int i=0; i<h; ++i) { for (int j=0; j<w; ++j) if (i==0 || i==h-1 || j==0 || j==w-1) cout << "#"; else cout << "."; cout << endl; } cout << endl; } int main(void) { int h, w; while ( cin >> h >> w && (h || w) ) Slove(h,w); return 0; }
再びやるだけ。。