# チャレンジ

Given an integer `n` (where
`4<=n<=10**6`) as input create an ASCII art
“prison door”* measuring `n-1` characters wide and
`n` characters high, using the symbols from the 例
below.

## 例

``````╔╦╗
╠╬╣
╠╬╣
╚╩╝
``````

``````┌───────────────┬─────────┬───────┐
│ Position      │ Symbol  │ Char  │
├───────────────┼─────────┼───────┤
│ Top Left      │    ╔    │ 9556  │
├───────────────┼─────────┼───────┤
│ Top           │    ╦    │ 9574  │
├───────────────┼─────────┼───────┤
│ Top Right     │    ╗    │ 9559  │
├───────────────┼─────────┼───────┤
│ Right         │    ╣    │ 9571  │
├───────────────┼─────────┼───────┤
│ Bottom Right  │    ╝    │ 9565  │
├───────────────┼─────────┼───────┤
│ Bottom        │    ╩    │ 9577  │
├───────────────┼─────────┼───────┤
│ Bottom Left   │    ╚    │ 9562  │
├───────────────┼─────────┼───────┤
│ Left          │    ╠    │ 9568  │
├───────────────┼─────────┼───────┤
│ Inner         │    ╬    │ 9580  │
└───────────────┴─────────┴───────┘
``````

## ルール

• You may take input by any reasonable, convenient means as long
as it’s permitted by standard I/O
ルール
.
• For the purposes of this チャレンジ, in languages where the symbols
used to build the “door” are multi-byte characters, they may be
counted towards your score as a single byte each.
• All other characters (single- or multi-byte) should be counted
as normal.
• Output may not contain any trailing spaces but a trailing
newline is permitted if absolutely necessary.
• This is
so lowest byte count wins.

## テストケース

``````Input: 4
Output:
╔╦╗
╠╬╣
╠╬╣
╚╩╝

Input: 8
Output:
╔╦╦╦╦╦╗
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╚╩╩╩╩╩╝

Input: 20
Output:
╔╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╗
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╚╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╝
``````

*はい、刑務所のドアのように見えなくなるほど大きくなることは承知しています！ ：D

ベストアンサー

# Java 8、 156 151 148 118バイト

``````n->{String a="╔",b="╠",c="╚";for(int i=n;i-->3;a+="╦",b+="╬")c+="╩";a+="╗n";for(b+="╣n";n-->2;)a+=b;return a+c+"╝";}
``````

@raznagul
C＃（.NET Core）の回答
のポートを作成して-30バイト、私は5バイトゴルフした後。

``````n->{String r="╔";int i=n,j;for(;i-->3;r+="╦");r+="╗n╠";for(i=n;i-->2;r+="╣n"+(i>2?"╠":"╚"))for(j=n;j-->3;r+="╬");for(;n-->3;r+="╩");return r+"╝";}
``````

@raznagul のおかげで-5バイト。

``````n->{                  //Method with integer parameter and String return-type
String r="╔";       // Result String (starting with the top-left corner)
int i=n,j;          // Indexes `i` and `j`
for(;i-->3;         // Loop (1) `n`-3 times:
r+="╦"          //  Append result with top edges
);                  // End of loop (1)
r+="╗n╠";          // Append result with the top-right corner, new-line and left edge
for(i=n;i-->2       // Loop (2) `n`-2 times
;               //    After every iteration:
r+="╣n"        //  Append result with right edge and new-line
+(i>2?"╠":"╚")) //   + either the left edge or bottom-left corner
for(j=n;j-->3;    //  Inner loop (3) `n`-3 times:
r+="╬"        //   Append result with middle section
);                //  End of inner loop (3)
// End of loop (2) (implicit/single-line body)
for(;n-->3;         // Loop (4) `n`-3 times:
r+="╩"            //  Append result with bottom edges
);                  // End of loop (4)
return r+"╝";       // Return result with its bottom-right corner
}                     //End of method
``````