过去,电话自动拨号器使用打孔卡,每列要拨打的号码中的每一列都有一栏。列有七行。前三行分别代表数字(1,2,3),(4,5,6)和(7,8,9)。最后三行将这种排列旋转90°:(1,4,7),(2,5,8)和(3,6,9)。中间的行用于0。任何数字1-9都会打两个孔-前三个行一个,下三个行一个。零将只打中间行。让我们可视化数字6的打孔列(.
未x
打孔,已打孔,左侧的指南仅用于说明编码):
123 .
456 x
789 .
0 .
147 .
258 .
369 x
我们寻找哪些行包含我们要拨打的号码。对于6,这是第二行,第九行。这两行被打孔,其余五行未打孔。这是所有0-9数字的打孔模式:
0 1 2 3 4 5 6 7 8 9
123 . x x x . . . . . .
456 . . . . x x x . . .
789 . . . . . . . x x x
0 x . . . . . . . . .
147 . x . . x . . x . .
258 . . x . . x . . x .
369 . . . x . . x . . x
您的目标是(编写程序或函数)为我打这些卡。
输入:一个数字,采用任何合理的格式(字符串,整数,整数列表等),且不得超过9999999999999。
输出:与数字输入相对应的打孔网格。您不需要上面显示的标题或多余的空格,只需要打孔的列本身即可。可以使用前导/后跟换行,只要行/列之间的空格一致,也可以。可以说,只要它们是一致的,就可以将任何(非空白)字符用于打孔,而将其他任何字符用于打孔(这很明显,请指定您使用的字符)。
这是代码高尔夫球,因此最短的代码获胜。不允许出现标准漏洞。
测试用例(全部.
用于未x
打孔,已打孔):
In: 911
Out: .xx
...
x..
...
.xx
...
x..
In: 8675309
Out: ....x..
.x.x...
x.x...x
.....x.
..x....
x..x...
.x..x.x
In: 5553226
Out: ...xxx.
xxx...x
.......
.......
.......
xxx.xx.
...x..x