結果

問題 No.1500 Super Knight
ユーザー 👑 tamatotamato
提出日時 2021-05-07 23:06:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 71,860 KB
最終ジャッジ日時 2023-10-13 14:25:14
合計ジャッジ時間 4,220 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,660 KB
testcase_01 AC 70 ms
71,380 KB
testcase_02 AC 69 ms
71,792 KB
testcase_03 AC 72 ms
71,784 KB
testcase_04 AC 69 ms
71,404 KB
testcase_05 AC 71 ms
71,756 KB
testcase_06 AC 69 ms
71,776 KB
testcase_07 AC 71 ms
71,812 KB
testcase_08 AC 71 ms
71,604 KB
testcase_09 AC 72 ms
71,496 KB
testcase_10 AC 71 ms
71,404 KB
testcase_11 AC 70 ms
71,840 KB
testcase_12 AC 72 ms
71,540 KB
testcase_13 AC 71 ms
71,752 KB
testcase_14 AC 71 ms
71,488 KB
testcase_15 AC 72 ms
71,404 KB
testcase_16 AC 72 ms
71,652 KB
testcase_17 AC 73 ms
71,860 KB
testcase_18 AC 72 ms
71,660 KB
testcase_19 AC 73 ms
71,720 KB
testcase_20 AC 71 ms
71,612 KB
testcase_21 AC 72 ms
71,640 KB
testcase_22 AC 71 ms
71,640 KB
testcase_23 AC 71 ms
71,580 KB
testcase_24 AC 72 ms
71,600 KB
testcase_25 AC 70 ms
71,500 KB
testcase_26 AC 72 ms
71,768 KB
testcase_27 AC 71 ms
71,648 KB
testcase_28 AC 72 ms
71,488 KB
testcase_29 AC 73 ms
71,832 KB
testcase_30 AC 73 ms
71,656 KB
testcase_31 AC 76 ms
71,840 KB
testcase_32 AC 70 ms
71,636 KB
testcase_33 AC 70 ms
71,636 KB
testcase_34 AC 72 ms
71,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    if N == 1:
        print(12)
    elif N == 2:
        print(65)
    elif N == 3:
        print(172)
    elif N == 4:
        print(297)
    else:
        ans = ((6 * N + 1) ** 2) // 2
        if N & 1:
            x = (N-1) * (N+1) // 4
        else:
            ans += 1
            x = ((N + 1) // 2) ** 2
        ans -= x * 4
        print(ans % mod)


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