結果

問題 No.1966 Median of Divisors
ユーザー sotanishysotanishy
提出日時 2022-06-03 21:49:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 417 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 76,336 KB
最終ジャッジ日時 2023-10-21 01:47:44
合計ジャッジ時間 4,093 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,340 KB
testcase_01 AC 38 ms
53,340 KB
testcase_02 AC 45 ms
55,388 KB
testcase_03 AC 50 ms
60,936 KB
testcase_04 AC 365 ms
76,152 KB
testcase_05 AC 417 ms
75,836 KB
testcase_06 AC 398 ms
75,860 KB
testcase_07 AC 109 ms
75,888 KB
testcase_08 AC 286 ms
76,112 KB
testcase_09 AC 351 ms
76,332 KB
testcase_10 AC 353 ms
76,336 KB
testcase_11 AC 191 ms
75,724 KB
testcase_12 AC 234 ms
75,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

mod = 10**9+7
T = int(input())
for _ in range(T):
    N, M = map(int, input().split())
    x = pow(N, M, mod)
    ans = x*(x+1)*pow(2, mod-2, mod)
    y = pow(N, M//2, mod)
    ans -= y*(y+1)*(2*y+1)*pow(6, mod-2, mod)
    print(ans % mod)
0