Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
30
Task/Five-weekends/Phix/five-weekends.phix
Normal file
30
Task/Five-weekends/Phix/five-weekends.phix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
sequence m31 = {"January",0,"March",0,"May",0,"July","August",0,"October",0,"December"}
|
||||
integer y,m,
|
||||
nmonths = 0
|
||||
string months
|
||||
sequence res = {},
|
||||
none = {}
|
||||
|
||||
for y=1900 to 2100 do
|
||||
months = ""
|
||||
for m=1 to 12 do
|
||||
if string(m31[m])
|
||||
and day_of_week(y,m,1)=6 then
|
||||
if length(months)!=0 then months &= ", " end if
|
||||
months &= m31[m]
|
||||
nmonths += 1
|
||||
end if
|
||||
end for
|
||||
if length(months)=0 then
|
||||
none = append(none,y)
|
||||
else
|
||||
res = append(res,sprintf("%d : %s\n",{y,months}))
|
||||
end if
|
||||
end for
|
||||
|
||||
printf(1,"Found %d months with five full weekends\n",nmonths)
|
||||
res[6..-6] = {" ...\n"}
|
||||
puts(1,join(res,""))
|
||||
printf(1,"Found %d years with no month having 5 weekends:\n",{length(none)})
|
||||
none[6..-6] = {".."}
|
||||
?none
|
||||
Loading…
Add table
Add a link
Reference in a new issue