在这个挑战中,你必须用心律问题(心律不齐)来刺激心脏,然后测量脉搏。别担心,这很容易!
心脏在这两种状态之间交替:
状态1
,d88b.d88b,
88888888888
`Y8888888Y'
`Y888Y'
`Y' d8b d8b
888888888
`Y88888P'
`Y888P'
`Y8P'
`Y'每一步都有X秒的延迟
其中X是介于0.3到1.4 (0.3<=X<=1.4)之间的随机(实)数。
当你的心律失常-心脏开始跳动时,你必须测量脉搏。
我们想知道心跳/分钟。
但是(和许多医生一样)你只需要数15秒的心跳,然后乘以4。
如果没有输入,代码必须运行15秒(显示跳动的心脏),然后打印心率。
您的输出应该完全像这样!
(我将运行我的代码2次,让您看到不同的结果)
第一个示例运行:

第二个示例运行:

你必须输出一颗心
祝好运!
这是暗号高尔夫
最短答案(以字节为单位)获胜!
发布于 2017-07-17 10:48:34
g=",d88b.d88b,
88888888888
`Y8888888Y'
`Y888Y'
`Y'";h=" d8b d8b
888888888
`Y88888P'
`Y888P'
`Y8P'
`Y'";t=1;TimeConstrained[Monitor[While[1<2,If[OddQ@t,b=g,b=h];Pause@RandomReal@{.3,1.4};t++],b],15];4t发布于 2017-07-16 23:51:41
from time import*
import os,random
t,i=time(),0
while time()-t<15:print([""",d88b.d88b,
88888888888
`Y8888888Y'
`Y888Y'
`Y'""",""" d8b d8b
888888888
`Y88888P'
`Y888P'
`Y8P'
`Y'"""][i%2]);i+=1;sleep(random.randint(3,14)/10);os.system('cls')
print(i*4)对于linux和macOS,多使用两个字节的os.system('clear')。
发布于 2017-07-17 08:22:39
,374个字节
class G{public static void main(String[]a)throws Exception{long t=System.currentTimeMillis(),i=0;while(System.currentTimeMillis()<15000+t){p(",d88b.d88b,\n88888888888\n`Y8888888Y'\n `Y888Y'\n `Y'\n");Thread.sleep((long)(300+(Math.random()*1100)));i++;p(" d8b d8b\n888888888\n`Y88888P'\n `Y888P'\n `Y8P'\n `Y'\n");}p(i*4);}static<T>void p(T s){System.out.println(s);}}未高尔夫球:
public class Golf {
public static void main(String[]a)throws Exception {
long t=System.currentTimeMillis(),i=0;
while(System.currentTimeMillis()<15000+t) {
p(",d88b.d88b,\n88888888888\n`Y8888888Y'\n `Y888Y'\n `Y'\n");
Thread.sleep((long)(300+(Math.random()*1100)));
i++;
p(" d8b d8b\n888888888\n`Y88888P'\n `Y888P'\n `Y8P'\n `Y'\n");
}
p(i*4);
}
static<T>void p(T s){System.out.println(s);}
}https://codegolf.stackexchange.com/questions/132745
复制相似问题