結果

問題 No.1229 ラグビーの得点パターン
ユーザー Theta
提出日時 2022-10-13 13:30:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-26 12:01:28
合計ジャッジ時間 2,157 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import count


def calc_try_and_conversion(point: int) -> int:
    ctr = 0

    for conversion in count():
        rest_point = point - 7 * conversion
        if rest_point < 0:
            break
        if rest_point % 5 == 0:
            ctr += 1
    return ctr


def main():
    N = int(input())

    patterns = 0
    for penalty_goal in count():
        rest_point = N - 3 * penalty_goal
        if rest_point < 0:
            break

        patterns += calc_try_and_conversion(rest_point)

    print(patterns)


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