Created
April 2, 2019 19:02
-
-
Save surgicalmaskman/59e081ad5e7090f894a93460d782f7d9 to your computer and use it in GitHub Desktop.
復活祭を無限に計算できるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import datetime | |
print("復活祭の日付を計算します。計算したい年を入力してください。") | |
y = input() | |
if y.isdigit() != True: | |
print("再入力。") | |
y = input() | |
else: | |
pass | |
if len(y) != 4: | |
print("再入力。") | |
y = input() | |
else: | |
y = int(y) | |
g = y % 19 | |
c = y // 100 | |
k = (c - 17) // 25 | |
h = (19 * g + 15 + c - c // 4 - (c - k) // 3) % 30 | |
i = h - (h // 28) * (1 - (29 // (h + 1)) * ((21 - g) // 11)) | |
j = (y + y // 4 - c + c // 4 + i + 2) % 7 | |
n = i - j | |
m = 3 + (n + 40) // 44 | |
d = n + 28 - 31 * (m // 4) | |
print("{}年の復活祭は{}月{:2}日。".format(y, m, d)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
やっぱりjawpってだめだわ。計算式は国立天文台による ( https://eco.mtk.nao.ac.jp/koyomi/wiki/A5A4A1BCA5B9A5BFA1BC.html )。