結果

問題 No.188 HAPPY DAY
ユーザー mega_yadoranmega_yadoran
提出日時 2018-10-22 11:02:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 27 ms / 1,000 ms
コード長 748 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-29 20:29:49
合計ジャッジ時間 490 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/bin/python
# Python 3.6+ で動作します。
# 2015 年の中で 4/22 : 4 = 2 + 2 の様な日付を探します

import datetime

current_date = datetime.date(2015, 1, 1)
end_date = datetime.date(2016, 1, 1)
a_day_duration = datetime.timedelta(days=1)


def is_happy_day(date):
    m = date.month
    d = date.day
    if d < 10:
        return m == d
    else:
        str_d = str(d)
        s = int(str_d[0]) + int(str_d[1])
        return m == s


if __name__ == '__main__':
    count_of_happy_day = 0
    while current_date < end_date:
        if is_happy_day(current_date):
            #print('isHappy: {current_date}')
            count_of_happy_day += 1
        current_date = current_date + a_day_duration
    print(count_of_happy_day)
0