結果

問題 No.1966 Median of Divisors
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-03 23:03:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 701 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2023-10-21 02:18:46
合計ジャッジ時間 6,158 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,360 KB
testcase_01 AC 40 ms
53,360 KB
testcase_02 AC 57 ms
60,984 KB
testcase_03 AC 68 ms
65,784 KB
testcase_04 AC 627 ms
77,588 KB
testcase_05 AC 701 ms
77,352 KB
testcase_06 AC 687 ms
77,332 KB
testcase_07 AC 159 ms
76,932 KB
testcase_08 AC 473 ms
77,584 KB
testcase_09 AC 590 ms
77,584 KB
testcase_10 AC 590 ms
77,696 KB
testcase_11 AC 317 ms
77,344 KB
testcase_12 AC 383 ms
77,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
mod = 10 ** 9 + 7
for i in range(t):
    n,m = map(int,input().split())
    ans = pow(n,m,mod) * (pow(n,m,mod) + 1) * pow(2,mod-2,mod)
    val = pow(n,m//2,mod)
    ans -= val * (val+1)*(2*val+1) * pow(6,mod-2,mod)
    
    print(ans%mod)
0