fork download
  1. #include<iostream>
  2. using namespace std;int main(){int w,h,i;for(;cin>>h>>w;cout<<endl)for(i=w*h+1;--i;)cout<<".#"[((i-1)/w+1)%h<2||i%w<2],!(i%w-1)&&cout<<endl;}
Success #stdin #stdout 0s 3344KB
stdin
3 4
5 6
3 3
0 0
stdout
####
#..#
####

######
#....#
#....#
#....#
######

###
#.#
###