/BUS - Xe buýt (Codeforces Bayan Warmup)

<Problem>

http://ntucoder.net/Problem/Details/92
              Uses Crt;
        Var n,i,j,temp1:longint; str_a,str_b:string; str_:array[0..10] of string;
        Begin
            readln(n);
            str_a:='+------------------------+';
            str_[1]:='|#.#.#.#.#.#.#.#.#.#.#.|D|)';
            str_[2]:='|#.#.#.#.#.#.#.#.#.#.#.|.|';
            str_[3]:='|#.......................|';
            str_[4]:='|#.#.#.#.#.#.#.#.#.#.#.|.|)';
            str_b:='+------------------------+';
            if n<=4 then temp1:=n else temp1:=4;
            j:=2; i:=0;
        
                 while temp1<>0 do
                  begin
                      inc(i);
                      str_[i][j]:='O';
                      temp1:=temp1-1;
                  end;
            j:=4; i:=0;  temp1:=n-4;
                 if n>4 then
                  begin
                      while temp1<>0 do
                       begin
                           if i=4 then
                            begin
                                i:=1;
                                inc(j,2);
                            end
                            else
                            inc(i);
                            if i=3 then inc(i);
        
                            str_[i][j]:='O';
                            temp1:=temp1-1;
        
                       end;
                  end;
            writeln(str_a);
            writeln(str_[1]);
            writeln(str_[2]);
            writeln(str_[3]);
            writeln(str_[4]);
            writeln(str_b);
            readln;
        End.