fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. for(int N=n<<1,y=1;y<=N;y+=2,cout<<endl) for(int x=1;x<=N;x+=2) cout<<((abs(y-n)+abs(x-n))<=n?'#':'.');
  9. return 0;
  10. }
  11.  
Success #stdin #stdout 0s 4388KB
stdin
5
stdout
..#..
.###.
#####
.###.
..#..