Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
17
Task/Palindrome-dates/EasyLang/palindrome-dates.easy
Normal file
17
Task/Palindrome-dates/EasyLang/palindrome-dates.easy
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
t = 1580641200
|
||||
print "First 15 palindrome dates after 2020-02-02 are:"
|
||||
repeat
|
||||
t += 86400
|
||||
a$ = timestr t
|
||||
a$[] = strchars substr a$ 1 4 & substr a$ 6 2 & substr a$ 9 2
|
||||
for i = 1 to 4
|
||||
if a$[i] <> a$[9 - i]
|
||||
break 1
|
||||
.
|
||||
.
|
||||
if i = 5
|
||||
cnt += 1
|
||||
print substr a$ 1 10
|
||||
.
|
||||
until cnt = 15
|
||||
.
|
||||
23
Task/Palindrome-dates/Lua/palindrome-dates.lua
Normal file
23
Task/Palindrome-dates/Lua/palindrome-dates.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local year = 2020
|
||||
for i=1, 15 do
|
||||
local dateS
|
||||
repeat
|
||||
year = year+1
|
||||
local yearS = tostring(year)
|
||||
local monthS, dayS = yearS:reverse():match"^(%d%d)(%d%d)$"
|
||||
local monthN, dayN = tonumber(monthS), tonumber(dayS)
|
||||
dateS = yearS.."-"..monthS.."-"..dayS
|
||||
until
|
||||
monthN>0 and monthN<=12 -- real month
|
||||
and dayN<32 -- possible day
|
||||
and os.date( -- real date check
|
||||
-- be aware that this check is unnecessary because it only affects the 13th century
|
||||
"%Y-%m-%d"
|
||||
,os.time{
|
||||
year = year
|
||||
,month = monthN
|
||||
,day = dayN
|
||||
}
|
||||
) == dateS
|
||||
print(dateS)
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import "/fmt" for Fmt
|
||||
import "/date" for Date
|
||||
import "./fmt" for Fmt
|
||||
import "./date" for Date
|
||||
|
||||
var isPalDate = Fn.new { |date|
|
||||
date = date.format(Date.rawDate)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue