first commit

This commit is contained in:
=
2024-02-07 15:06:50 +01:00
commit af02e453c1
55 changed files with 2166 additions and 0 deletions

29
p19/solution.jl Normal file
View File

@@ -0,0 +1,29 @@
function solution()
n_months = 12
n_years = 100
n = 0
day = 1
for i = 1:n_months*n_years
if (day-1)%7+1 == 7
n += 1
end
day += step(i)
end
return n
end
function step(next::Int)
year = (next-1)÷12+1
month = (next-1)%12+1
if month [4, 6, 9, 11]
return 30
elseif month [1, 3, 5, 7, 8, 10, 12]
return 31
elseif year % 4 == 0
return 29
else return 28
end
end
# solved by chatGPT
println(solution())