結果

問題 No.1966 Median of Divisors
ユーザー hir355hir355
提出日時 2022-06-03 21:41:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 76,908 KB
最終ジャッジ日時 2023-10-21 01:42:39
合計ジャッジ時間 4,656 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,288 KB
testcase_01 AC 38 ms
53,288 KB
testcase_02 AC 55 ms
60,832 KB
testcase_03 AC 64 ms
65,592 KB
testcase_04 AC 418 ms
75,660 KB
testcase_05 AC 481 ms
75,640 KB
testcase_06 AC 470 ms
76,908 KB
testcase_07 AC 125 ms
75,648 KB
testcase_08 AC 321 ms
75,664 KB
testcase_09 AC 392 ms
75,664 KB
testcase_10 AC 399 ms
75,668 KB
testcase_11 AC 224 ms
75,640 KB
testcase_12 AC 275 ms
75,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(n):
    return n * (n + 1) // 2

def f2(n):
    return n * (n + 1) * (2 * n + 1) // 6

MOD = 10 ** 9 + 7
t = int(input())
for _ in range(t):
    n, m = map(int, input().split())
    print((f(pow(n, m, MOD)) - f2(pow(n, m // 2, MOD))) % MOD)
0