计数杆；数你的杆

9

运作方式如下：

（如果您在任何时候感到困惑，请查看每个数字的ascii表示形式以及我在底部提供的一些示例）

`````` |||
|||
|||
|||
|||
``````

``````  |
|
__|__
_____
_____
``````

挑战

``````space between two digits (two colums):

0 digit, both vertical and horizontal (five columns):

1 digit, vertical:
|
|
|
|
|

2 digit, vertical:
| |
| |
| |
| |
| |

3 digit, vertical:
|||
|||
|||
|||
|||

4 digit, vertical:
|| ||
|| ||
|| ||
|| ||
|| ||

5 digit, vertical:
|||||
|||||
|||||
|||||
|||||

6 digit, vertical:
_____
|
|
|
|

7 digit, vertical:
_____
| |
| |
| |
| |

8 digit, vertical:
_____
|||
|||
|||
|||

9 digit, vertical:
_____
|| ||
|| ||
|| ||
|| ||

1 digit, horizontal:

_____

2 digit, horizontal:

_____
_____

3 digit, horizontal:

_____
_____
_____

4 digit, horizontal:

_____
_____
_____
_____

5 digit, horizontal:
_____
_____
_____
_____
_____

6 digit, horizontal:
|
|
|
|
__|__

7 digit, horizontal:
|
|
|
__|__
_____

8 digit, horizontal:
|
|
__|__
_____
_____

9 digit, horizontal:
|
__|__
_____
_____
_____
``````

输出示例

``````>12
| |
| |
| |
| |
_____   | |

>8037
|                  _____
|                   | |
__|__         _____   | |
_____         _____   | |
_____         _____   | |

>950
_____  _____
|| ||  _____
|| ||  _____
|| ||  _____
|| ||  _____
``````

John Dvorak 2014年

@JanDvorak仅通过最后一位数字的边界框。如果需要Trailig空格来表示一个数字的整个边界框，则需要它们。
overactor 2014年

edc65 2014年

@ edc65是的，谢谢你指出这一点。
overactor 2014年

3

Python 2-216

``````x=raw_input()
for l in range(5):print'  '.join((' '*7+'|   | |  ||| || '+'|'*7+'__|'+'_'*7)[[7*(4-l<n%6+n/6)+(n>5)*(l<10-n)-(l==10-n),n%6+n/6+(l<1)*(n>5)*(12-n)][(len(x)-i)%2]*5:][:5]for i,n in enumerate(map(int,x)))
``````

2

JavaScript（ES6）223

``````F=n=>{
for(r=s='',n+=s;r<5;r++,s+=q)
for(f=q='\n',p=n.length;f=!f,p--;q=(p?'  ':'')+'     1  |  1 | | 1 ||| 1|| ||1|||||1_____1__|__'.split(1)[d]+q)
if(d=~~n[p])e=d+r,d=d>5?f?e<10?1:e>10?6:7:r?d-5:6:f?e>4?6:0:d;
console.log(s)
}
``````

`F(12)`

``````        | |
| |
| |
| |
_____   | |
``````

`F(8037)`

``````  |                  _____
|                   | |
__|__         _____   | |
_____         _____   | |
_____         _____   | |
``````

`F(950)`

``````_____  _____
|| ||  _____
|| ||  _____
|| ||  _____
|| ||  _____
``````

``````F=n=>{
z='     1  |  1 | | 1 ||| 1|| ||1|||||1_____1__|__'.split(1);
s='';
n+=s;

for (r = 0; r < 5; r++)
{
for(q='\n',f=1,p=n.length;f=!f,p--;)
{
d = ~~n[p];
if (d)
{
e=d+r;
if (d > 5)
{
if (f)
{
d = e < 10 ? 1 : e >10 ? 6 : 7;
}
else
{
d = r ? d-5 : 6;
}
}
else
{
if (f)
d = e > 4 ? 6 : 0;
}
}
q = (p ? '  ' : '') + z[d] + q;
}
s+=q
}

console.log(s)
}
``````

1

PowerShell，229字节

``````\$n="\$args"
0..4|%{\$l=\$_;\$h=\$n.Length%2
(\$n|% t*y|%{(' '*7+'|   | |  ||| || '+'|'*7+'_'*7+'|__')|% S*g(5*(('0123456666'+'0123451234'*4+'00000611110000661117000666117600666617660666667666')[50*(\$h=!\$h)+10*\$l+"\$_"]-48))5})-join'  '}``````

``````# 0       1       2       3       4       5       6       7
# '     '.'  |  ',' | | ',' ||| ','|| ||','|||||','_____','__|__'``````

``````"       |   | |  ||| || |||||||____________________"+   # 0123456666
"       |   | |  ||| || |||||||  |   | |  ||| || ||"+   # 0123451234
"       |   | |  ||| || |||||||  |   | |  ||| || ||"+   # 0123451234
"       |   | |  ||| || |||||||  |   | |  ||| || ||"+   # 0123451234
"       |   | |  ||| || |||||||  |   | |  ||| || ||"    # 0123451234``````

``````"                         _____  |    |    |    |  "+   # 0000061111
"                    __________  |    |    |  __|__"+   # 0000661117
"               _______________  |    |  __|_______"+   # 0006661176
"          ____________________  |  __|____________"+   # 0066661766
"     ___________________________|_________________"    # 0666667666``````

``````\$digits=' '*7+'|   | |  ||| || '+'|'*7+'_'*7+'|__'
\$positions = '0123456666'+'0123451234'*4+'00000611110000661117000666117600666617660666667666'

\$n="\$args"
0..4|%{
\$line=\$_
\$horizontal=\$n.Length%2
\$chunks=\$n|% toCharArray|%{
\$horizontal=!\$horizontal
\$startFrom = 5*(\$positions[50*\$horizontal+10*\$line+"\$_"]-48)
\$digits|% Substring \$startFrom 5
}
\$chunks-join'  '
}``````

1

mazzy

Veskah