给定一个数字n,输出数据可分为传统的每组5次和每一行50次.
1
|
|
|
|4.
||||
||||
||||
||||5
|||/
||/|
|/||
/|||6
|||/ |
||/| |
|/|| |
/||| |50
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 51
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|
|
|
|256
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /|||
|||/ |
||/| |
|/|| |
/||| ||字符组成。/字符,对角线。n的限制是:0 <= n <= 1000 (为了简单起见)。由~4人在沙盒审查。
有趣的是,监狱里每行的平均人数是50人,所以才算得上alt。标题。
发布于 2017-11-14 00:46:19
发布于 2017-11-14 13:22:58
:5[“|||/”]ẋ;”|ẋ⁸%5¤¤W¤ṙ€4Ḷ¤s⁵Z€G€j⁾¶¶:5[“|||/”]ẋ;”|ẋ⁸%5¤¤W¤ṙ€4Ḷ¤s⁵Z€G€j⁾¶¶ Main Link
:5 Floordiv by 5
[“|||/”]ẋ Repeat ["|||/"] by this number
; Append
”|ẋ ¤ "|" repeated by
⁸%5¤ The argument modulo 5
W¤ Then wrapped to prevent weirdness
ṙ€ Rotate each tally segment by
4Ḷ¤ (each) [0, 1, 2, 3]
s⁵ Slice into pieces of length 10 (to get 50 per row)
Z€ Transpose each
G€ Convert each into a grid
j⁾¶¶ Join these grids by a double newline这太长了
发布于 2017-11-14 13:55:33
J;øṀṪṙŀ4C10§:oR"|||/"÷5oR'|%5我觉得第一个5是多余的,但是删除它会产生一个类型错误.
J;øṀṪṙŀ4C10§:oR"|||/"÷5oR'|%5 Implicit input, an integer n.
oR'| Repeat the character '|'
%5 n mod 5 times.
oR"|||/" Repeat the string "|||/"
÷5 n/5 times.
§: Tack the '|'-string to the end of that list.
C10 Cut the list of strings into pieces of length 10.
Ṁ For each piece,
Ṫ ŀ4 for each k in [0,1,2,3],
ṙ rotate each string k steps to the left
and collect the results into a list.
Now we have a list of lists of lists of strings.
J;ø Join them with the list [[]].
Implicitly join each list of strings by spaces,
then join the resulting list of strings by newlines,
and print the result.https://codegolf.stackexchange.com/questions/147962
复制相似问题