发布于 2015-07-20 03:27:30
我肯定有人会打得这么快,但只是一个基本的压缩答案,因为我觉得很懒。我很快就会试着写一个严肃的答案。
s@L"
+-|"jC" zB²;¶Ê ¿ïÁ»#-ÌClHõy%|ap"5在网上试试。
s Reduce on string concatenation
@L Map second arg to index first arg
"..." String of all chars (Pyth allows literal newlines)
j Base conversion to list
C Base conversion 256 -> 10
"..." Base 256 string
5 To Base 5发布于 2015-07-20 10:18:18
jbc11s@L"+ -|"jC"Tª]UʨWÕÝ_K¨}ÝÝ÷K¨Ý]Òê]UÕ*¡"4游行示威。
这使用基4编码,并将字符串拆分为十一个,然后在换行符上重新加入它们。
发布于 2015-07-20 11:06:22
-2.upto(8){|i|s=" "*(i%6)+"+-----+"*(1-i%2)+" "*9
6.times{|j|"@d me?K[RR@"[i+2].ord>>j&1>0&&s[j*2]=?|}
puts s}与直碱基转换不同的东西。
未高尔夫球:
-2.upto(8){|i| #for each line
s=" "*(i%6)+"+-----+"*(1-i%2)+" "*9 #load s with "+-----+" (if required!) padded appropriately with leading spaces and with nine trailing spaces.
6.times{|j|"@d me?K[RR@"[i+2].ord>>j&1>0&&s[j*2]=?|} #replace characters with | as necessary, according to the 6-bit number encoded by each character in the magic string.
puts s} #print the line.https://codegolf.stackexchange.com/questions/53417
复制相似问题