結果

問題 No.660 家を通り過ぎないランダムウォーク問題
ユーザー maspy
提出日時 2020-04-02 23:15:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 490 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-28 15:23:40
合計ジャッジ時間 5,360 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
MOD = 10 ** 9 + 7

N = int(readline())


def gen_hook_nums():
    x = 1
    yield x
    i = 1
    while True:
        num = (2 * i + N - 1) * (2 * i + N - 2)
        den = i * (N + i)
        x = x * num * pow(den, MOD - 2, MOD) % MOD
        yield x
        i += 1


g = gen_hook_nums()
answer = sum(itertools.islice(g, N // 2 + 1)) % MOD
print(answer)
0