首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基本ASCII计数

基本ASCII计数
EN

Code Golf用户
提问于 2017-11-13 22:55:01
回答 10查看 2.2K关注 0票数 36

备选标题:把你的刑期记在墙上

给定一个数字n,输出数据可分为传统的每组5次和每一行50次.

示例

1

代码语言:javascript
复制
|
|
|
|

4.

代码语言:javascript
复制
||||
||||
||||
||||

5

代码语言:javascript
复制
|||/
||/|
|/||
/|||

6

代码语言:javascript
复制
|||/ |
||/| |
|/|| |
/||| |

50

代码语言:javascript
复制
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

51

代码语言:javascript
复制
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|
|
|
|

256

代码语言:javascript
复制
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/| ||/|
|/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/|| |/||
/||| /||| /||| /||| /||| /||| /||| /||| /||| /||| 

|||/ |
||/| |
|/|| |
/||| |

规则

  • 每组5人,每排50人。
  • 前4个数字是垂直的,第5个数字与所有其他数字相交。
    • 前四个字符中的每一个都由4个垂直|字符组成。
    • 最后的第五次统计跨越所有的第四个,带有一个/字符,对角线。

  • 每个组应该用空格分隔,每一行都是空白换行符。
  • n的限制是:0 <= n <= 1000 (为了简单起见)。
  • 尾随空格和换行符很好,前面则不是。
  • 这是密码-高尔夫ascii-art,最低字节数胜利者。

由~4人在沙盒审查。

有趣的是,监狱里每行的平均人数是50人,所以才算得上alt。标题。

EN

回答 10

Code Golf用户

发布于 2017-11-14 00:46:19

哈斯克尔,117个字节

代码语言:javascript
复制
f m|m<1=""|n<-min 50 m=unlines[[last$"| "!!(0^c%5):['/'|r+c%5==4,n-n%5>c]|c<-[1..n]]|r<-[0..3]]++'\n':f(m-50)
(%)=mod

在网上试试!

票数 6
EN

Code Golf用户

发布于 2017-11-14 13:22:58

果冻,37字节

代码语言:javascript
复制
:5[“|||/”]ẋ;”|ẋ⁸%5¤¤W¤ṙ€4Ḷ¤s⁵Z€G€j⁾¶¶

在网上试试!

解释

代码语言:javascript
复制
: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

这太长了

票数 5
EN

Code Golf用户

发布于 2017-11-14 13:55:33

外壳,29字节

代码语言:javascript
复制
J;øṀṪṙŀ4C10§:oR"|||/"÷5oR'|%5

在网上试试!

我觉得第一个5是多余的,但是删除它会产生一个类型错误.

解释

代码语言:javascript
复制
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.
票数 5
EN
页面原文内容由Code Golf提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://codegolf.stackexchange.com/questions/147962

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档