儿时的歌曲“Eeny,meeny,miny,moe”常被用来选择在打标签时谁是“它”。每个人都会站成一个圆圈,指着随机挑选的一个人。他们会唱:
Eeny,meeny,miny,moe,在toe.身边抓到一只老虎,如果他叫,放他走, Eeny,meeny,miny,moe。
当他们唱着每一个单词时,他们指着圆圈中的下一个人。当唱最后的"moe“时被指的人是"it”。孩子们立刻站起来散开。
实现以字节为单位的最短程序,该程序接受输入、孩子的数量,并列出在被指向时被唱的单词。
获奖者将在一周内获选。
从STDIN,一个单一的正整数,孩子的数量。这可能比歌曲中的字数还多。
向STDOUT写入一个列表,其中每一行代表一个子行,并包含指向它们时所唱的单词。如果有太多的子行,可以省略空行。
3Eeny moe tiger toe hollers go miny
meeny Catch by If let Eeny MOE!
miny a the he him meeny7Eeny by him
meeny the go
miny toe Eeny
moe If meeny
Catch he miny
a hollers MOE!
tiger let1Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!21Eeny
meeny
miny
moe
Catch
a
tiger
by
the
toe
If
he
hollers
let
him
go
Eeny
meeny
miny
MOE!发布于 2016-01-20 01:19:57
“£Dṡ“Ṙ©“Ė“¡Ḳ⁵“=U“¡Ẹ⁵“¡Ṇm“ȯf“ŀQ“ÞṖċ¥“ṅ_“Ẉ1“¡æḷ“¡ƒmxĠ“¡ṇƭEỤr“¡Þ¦»ṫ-2;;“MOE!”W¤sƓZj€⁶j⁷在网上试试!
发布于 2016-01-20 06:45:54
a=prompt(),b=Array(a--).fill``,c=0;"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!".split` `.map(v=>(b[c]+=v+' ',c+=c>a-1?-c:1));alert(b.join`\n`)a=prompt(), //Get the STDIN
b=Array(a--).fill``, //Make an array based on how many kids there are
c=0; //Start the iteration variable
"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!"
.split` `.map(
v=>(
b[c] += v + ' ',
c += c > a - 1 ? -c : 1
)
);alert(b.join`\n`)发布于 2016-01-20 11:50:00
StringRiffle[Thread@Partition[StringSplit@"Eeny meeny miny moe Catch a tiger by the toe If he hollers let him go Eeny meeny miny MOE!",#,#,1,""],"
"," "]&使用大多数其他答案的拆分块转置连接输出方法。
https://codegolf.stackexchange.com/questions/69722
复制相似问题