結果

問題 No.1966 Median of Divisors
ユーザー pitPpitP
提出日時 2022-06-03 22:08:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 229 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 76,976 KB
最終ジャッジ日時 2023-10-21 01:54:32
合計ジャッジ時間 4,596 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,336 KB
testcase_01 AC 39 ms
53,336 KB
testcase_02 AC 56 ms
60,928 KB
testcase_03 AC 65 ms
65,712 KB
testcase_04 AC 413 ms
75,792 KB
testcase_05 AC 476 ms
75,772 KB
testcase_06 AC 443 ms
76,976 KB
testcase_07 AC 126 ms
75,784 KB
testcase_08 AC 316 ms
75,788 KB
testcase_09 AC 392 ms
75,792 KB
testcase_10 AC 392 ms
75,796 KB
testcase_11 AC 223 ms
75,772 KB
testcase_12 AC 273 ms
75,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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