結果

問題 No.906 Y字グラフ
ユーザー lam6er
提出日時 2025-03-31 17:22:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 53,920 KB
最終ジャッジ日時 2025-03-31 17:23:17
合計ジャッジ時間 2,611 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7

N = int(input())
if N < 4:
    print(0)
else:
    M = N - 1
    s3 = 1 if M % 3 == 0 else 0
    s2_part1 = (M - 1) // 3
    s2_part2 = max(0, ( (M - 1) // 2 ) - (M // 3))
    s2 = s2_part1 + s2_part2

    numerator = M * M - 3 * M + 2 + 6 * s2 + 10 * s3
    res = numerator // 12
    print(res % MOD)
0