結果

問題 No.87 Advent Calendar Problem
ユーザー pekempeypekempey
提出日時 2015-10-11 19:42:15
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 412 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 78,016 KB
実行使用メモリ 79,328 KB
最終ジャッジ日時 2023-09-28 12:11:13
合計ジャッジ時間 3,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
78,912 KB
testcase_01 AC 86 ms
79,008 KB
testcase_02 AC 86 ms
78,856 KB
testcase_03 AC 84 ms
79,328 KB
testcase_04 AC 85 ms
79,124 KB
testcase_05 AC 84 ms
78,944 KB
testcase_06 AC 84 ms
78,952 KB
testcase_07 AC 84 ms
78,952 KB
testcase_08 AC 86 ms
78,860 KB
testcase_09 AC 84 ms
79,236 KB
testcase_10 AC 85 ms
78,736 KB
testcase_11 AC 85 ms
78,740 KB
testcase_12 AC 83 ms
78,856 KB
testcase_13 AC 83 ms
78,792 KB
testcase_14 AC 84 ms
79,196 KB
testcase_15 AC 83 ms
78,620 KB
testcase_16 AC 83 ms
78,648 KB
testcase_17 AC 84 ms
79,120 KB
testcase_18 AC 85 ms
78,856 KB
testcase_19 AC 82 ms
79,004 KB
testcase_20 AC 82 ms
79,020 KB
testcase_21 AC 85 ms
78,896 KB
testcase_22 AC 85 ms
79,004 KB
testcase_23 AC 86 ms
78,644 KB
testcase_24 AC 84 ms
78,740 KB
testcase_25 AC 85 ms
78,916 KB
testcase_26 AC 84 ms
79,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def fairfield(y, m, d):
	if m <= 2:
		y -= 1
		m += 12
	return 365 * y + y / 4 - y / 100 + y / 400 + 306 * (m + 1) / 10 + d - 428

def zeller(y, m, d):
	return fairfield(y, m, d) % 7

N = input()

num = 0
total = [0] * 2800
y, m, d = 2014, 7, 23
for i in xrange(2800):
	if zeller(y + i, m, d) == 3:
		num += 1
	total[i] = num

q = (N - y) / 2800
ans = total[N - y - 2800 * q] + total[2800 - 1] * q - 1
print ans
0