結果

問題 No.87 Advent Calendar Problem
ユーザー is_eri23is_eri23
提出日時 2014-12-22 22:00:55
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 6,628 KB
実行使用メモリ 7,080 KB
最終ジャッジ日時 2023-09-02 21:30:17
合計ジャッジ時間 1,798 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
6,900 KB
testcase_01 AC 17 ms
6,880 KB
testcase_02 AC 17 ms
6,880 KB
testcase_03 AC 17 ms
7,004 KB
testcase_04 AC 19 ms
7,020 KB
testcase_05 AC 17 ms
6,884 KB
testcase_06 AC 18 ms
7,036 KB
testcase_07 AC 17 ms
6,900 KB
testcase_08 AC 18 ms
7,024 KB
testcase_09 AC 18 ms
7,024 KB
testcase_10 AC 17 ms
6,816 KB
testcase_11 AC 17 ms
7,040 KB
testcase_12 AC 17 ms
6,836 KB
testcase_13 AC 17 ms
7,080 KB
testcase_14 AC 17 ms
6,916 KB
testcase_15 AC 17 ms
6,880 KB
testcase_16 AC 17 ms
6,892 KB
testcase_17 AC 18 ms
7,020 KB
testcase_18 AC 17 ms
6,916 KB
testcase_19 AC 17 ms
6,836 KB
testcase_20 AC 17 ms
6,972 KB
testcase_21 AC 17 ms
7,060 KB
testcase_22 AC 17 ms
7,060 KB
testcase_23 AC 17 ms
6,896 KB
testcase_24 AC 17 ms
7,020 KB
testcase_25 AC 17 ms
6,924 KB
testcase_26 AC 17 ms
6,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from collections import * #deque, Counter,OrderedDict,defaultdict
#set([]) 
import math
import copy
import itertools
import string
import sys
import datetime
myread = lambda : map(int,raw_input().split())
#2014 / 7 / 23

def naive_cnt(y1,y2):
    if y2 > 9999:
        y1,y2 = y1 % 400, (y2-y1) + (y1%400)
        
        
    base = datetime.date(2014,7,23)
    ret = 0
    for l in xrange(y1,y2+1):
        now = datetime.date(l,7,23)
        if now.weekday() == base.weekday():
            ret += 1
    return ret

def solver():
    N = int(raw_input())
    x = (N - 2014) / 400
    ans = x * naive_cnt(2014,2014+400-1)
    ans += naive_cnt(x * 400 + 2014,N)
    print ans - 1


if __name__ == "__main__":
    solver()
    
0