在这个挑战中,您需要确定是Pi日、Pi分钟还是Pi秒。
因为Pi是不合理的,所以它希望您的代码尽可能短。
不提供输入,您的程序应该使用系统时间。我只是为了清楚地加入了它
March 14, 2016 0:00:00
Pi Day
December 25, 2015 3:14:45
Pi Minute
December 29, 2015 0:03:14
Pi Second
January 1, 2016 0:00:00
<No Output>?
Pi Day是三月的月份,而日期是十四号Pi Minute是当时间是3,分钟是14。Pi Second是当分钟是3,第二个是14Pi Day应该是首选而不是Pi Minute或Pi Second,而Pi Minute应该是首选而不是Pi Second。Pi Day/Minute/Second的日期/时间应基于系统时间。-15字节加值:如果您在没有Pi时间的情况下打印"No Pi Time"。
和往常一样,标准漏洞是不允许的。这是密码-高尔夫最短的字节代码赢!
发布于 2016-01-02 10:07:03
et[3E]#"
Pi Day
Pi Minute
Pi Second
"N/=在这里测试一下。或者使用此链接来存根et的结果,以便更容易地进行测试。
et e# Get the current datetime as an array with the following elements:
e# - Year
e# - Month
e# - Day
e# - Hour
e# - Minute
e# - Second
e# - Millisecond
e# - Weekday
e# - Tickrate or something.
[3E] e# Push the array [3 14].
# e# Find the position of this subarray in the current datetime array. Let's see
e# what results we can get:
e# - Year 3 is in the past and there is no 14th month, so we can't get 0.
e# - Pi day will give result 1.
e# - Day 3, hour 14 would give 2.
e# - Pi minute will give result 3.
e# - Pi second will give result 4.
e# - Second 3, millisecond 14 would give 5.
e# - Weekday and tickrate won't be 14, so we'll never get 6 or 7.
e# - If [3 14] isn't found at all we get -1.
"\Pi Day\\Pi Minute\Pi Second\"
e# Push this string (with linefeeds instead of backslashes.
N/ e# Split into lines.
= e# Select the corresponding element. The non-existent "pi hour" and "pi millisecond"
e# would map to empty strings as well as the -1.发布于 2016-01-02 14:13:55
D=Ð)g ¥3©Df ¥E?"Pi Day":Dd %C¥3©Dc ¥E?`Pi M©e`:Dc ¥3©Db ¥E?`Pi SeÖ:No Pi Te很直截了当-检查每一件案子的日期。
解释:
D=Ð)g获取当前日期(Ð),将其存储在变量D中,并获取月份(g)。如果它已经是一个字母,为什么要把它存储在变量中呢?因为从那时起,您可以使用Da来修饰日期的任何部分,其中a是函数,返回年份、月份、日期等。但是,否则您必须做Ð a,查看空格。¥3是==3,检查月份是否是3月。©是&&,即"and“。Df是一个月中的一天。E是14岁?...:... -三值算子的典型集Dd %C提醒将小时(Dd)除以12 (C)Dc是分钟Db是秒在网上试试!
为了模仿Pi日:
D=Ð"3/14/11 11:11:11";
Dg ¥2©Df ¥E?"Pi Day":Dd %C¥3©Dc ¥E?`Pi M©e`:Dc ¥3©Db ¥E?`Pi SeÖ:No Pi Te模仿Pi分钟:
D=Ð"11/11/11 3:14:11";
Dg ¥2©Df ¥E?"Pi Day":Dd %C¥3©Dc ¥E?`Pi M©e`:Dc ¥3©Db ¥E?`Pi SeÖ:No Pi Te模仿Pi秒:
D=Ð"11/11/11 00:3:14";
Dg ¥2©Df ¥E?"Pi Day":Dd %C¥3©Dc ¥E?`Pi M©e`:Dc ¥3©Db ¥E?`Pi SeÖ:No Pi Te发布于 2016-01-02 01:26:51
感谢FlagAsSpam剃了几个字节。
"→Str1
getTime
If min({3,14}={Ans(2),Ans(3
"Pi Second→Str1
getTime
If Ans(2)=14 and max(Ans(1)={3,14
"Pi Minute→Str1
getDate
If min({3,14}={Ans(2),Ans(3)
"Pi Day→Str1
Str1https://codegolf.stackexchange.com/questions/68371
复制相似问题