高尔夫代码:ASCII 艺术编号

发布于 2024-09-06 03:53:06 字数 782 浏览 2 评论 0原文

可能的重复:
代码高尔夫 - 横幅生成

发布您将数字转换为 ASCII 艺术数字的最短代码。

输入 - 假设已设置名为z 的整数变量,其中包含该数字。

输出 - 将输出打印到控制台。

质量 - 字符数越少越好。

格式 - 灵活,只要它是 ASCII 艺术并且看起来像数字。数字之间还必须有一些间距。

测试输入:365

GGGGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG
..........G....G..............G..........
..........G....G..............G..........
..GGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG
..........G....G..........G.............G
..........G....G..........G.............G
GGGGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG

Possible Duplicate:
Code Golf - Banner Generation

Post your shortest code to convert a number into a ASCII art digits.

Input - Assume that an integer variable called z has already been set containing the number.

Output - Print the output to the console.

Quality - The lower number of characters, the better.

Formatting - Flexible, providing it is ASCII art and looks like a number. There must also be some spacing between digits.

Test input: 365

GGGGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG
..........G....G..............G..........
..........G....G..............G..........
..GGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG
..........G....G..........G.............G
..........G....G..........G.............G
GGGGGGGGGGG....GGGGGGGGGGGG...GGGGGGGGGGG

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜无邪 2024-09-13 03:53:06

Python:173 个字符

for i in range(5):
    a=""
    for j in str(z):
        y=int("03330222220201002020330220102001030022220303003020"[int(j)*5+i])*8
        a+="."+("#"*9+"."*14+"##"+"."*6+"#")[y:y+8]
    print a

Python: 173 characters

for i in range(5):
    a=""
    for j in str(z):
        y=int("03330222220201002020330220102001030022220303003020"[int(j)*5+i])*8
        a+="."+("#"*9+"."*14+"##"+"."*6+"#")[y:y+8]
    print a
孤独岁月 2024-09-13 03:53:06

Bash:9 个字符

figlet $z

;)

Bash: 9 characters

figlet $z

;)

夏末染殇 2024-09-13 03:53:06

Ruby -

(0..4).map{|i|puts z.to_s.chars.map{|j|(?#*9+?.*14+'##'+?.*6+?#)[(?0+"ubp9x453o9jzme0cs08".to_i(36).to_s(4))[j.to_i*5+i].to_i*8,8]+' '}*''}

z = 365 的 139 个字符输出

> asciinum.rb
######## ######## ########
.......# #....... #.......
######## ######## ########
.......# #......# .......#
######## ######## ########

Ruby - 139 chars

(0..4).map{|i|puts z.to_s.chars.map{|j|(?#*9+?.*14+'##'+?.*6+?#)[(?0+"ubp9x453o9jzme0cs08".to_i(36).to_s(4))[j.to_i*5+i].to_i*8,8]+' '}*''}

Output for z = 365

> asciinum.rb
######## ######## ########
.......# #....... #.......
######## ######## ########
.......# #......# .......#
######## ######## ########
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文