結果

問題 No.87 Advent Calendar Problem
ユーザー pekempeypekempey
提出日時 2015-10-11 19:41:15
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 77,976 KB
実行使用メモリ 79,436 KB
最終ジャッジ日時 2023-09-28 12:11:02
合計ジャッジ時間 4,109 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 87 ms
78,836 KB
testcase_04 AC 86 ms
78,928 KB
testcase_05 AC 84 ms
78,908 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 87 ms
78,836 KB
testcase_18 AC 85 ms
79,228 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

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(1, 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
print ans
0