Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
50
Task/Five-weekends/Action-/five-weekends.action
Normal file
50
Task/Five-weekends/Action-/five-weekends.action
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
;https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#Sakamoto.27s_methods
|
||||
BYTE FUNC DayOfWeek(INT y BYTE m,d) ;1<=m<=12, y>1752
|
||||
BYTE ARRAY t=[0 3 2 5 0 3 5 1 4 6 2 4]
|
||||
BYTE res
|
||||
|
||||
IF m<3 THEN
|
||||
y==-1
|
||||
FI
|
||||
res=(y+y/4-y/100+y/400+t(m-1)+d) MOD 7
|
||||
RETURN (res)
|
||||
|
||||
PROC Main()
|
||||
BYTE ARRAY m31=[1 3 5 7 8 10 12]
|
||||
INT ARRAY years(250)
|
||||
BYTE ARRAY months(250)
|
||||
INT y
|
||||
BYTE i,m,mCount,yCount,found,c
|
||||
|
||||
mCount=0 yCount=0 c=0
|
||||
FOR y=1900 TO 2100
|
||||
DO
|
||||
found=0
|
||||
FOR i=0 TO 6
|
||||
DO
|
||||
m=m31(i)
|
||||
IF DayOfWeek(y,m,1)=5 THEN
|
||||
years(mCount)=y
|
||||
months(mCount)=m
|
||||
found=1
|
||||
mCount==+1
|
||||
FI
|
||||
OD
|
||||
IF found=0 THEN
|
||||
yCount==+1
|
||||
FI
|
||||
OD
|
||||
Print("5-weekend months in 1900-2100: ") PrintBE(mCount)
|
||||
Print("non 5-weekend years in 1900-2100: ") PrintBE(yCount)
|
||||
PutE()
|
||||
|
||||
FOR i=0 TO 4
|
||||
DO
|
||||
PrintI(years(i)) Put('/) PrintBE(months(i))
|
||||
OD
|
||||
PrintE("...")
|
||||
FOR i=mCount-5 TO mCount-1
|
||||
DO
|
||||
PrintI(years(i)) Put('/) PrintBE(months(i))
|
||||
OD
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue