結果

問題 No.1966 Median of Divisors
ユーザー hiro1729hiro1729
提出日時 2024-02-23 09:02:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 251 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,008 KB
最終ジャッジ日時 2024-02-23 09:02:47
合計ジャッジ時間 5,928 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 37 ms
53,332 KB
testcase_02 AC 53 ms
61,000 KB
testcase_03 AC 62 ms
65,804 KB
testcase_04 AC 417 ms
75,872 KB
testcase_05 AC 479 ms
75,872 KB
testcase_06 AC 444 ms
77,008 KB
testcase_07 AC 121 ms
75,872 KB
testcase_08 AC 320 ms
75,872 KB
testcase_09 AC 395 ms
75,872 KB
testcase_10 AC 396 ms
75,872 KB
testcase_11 AC 223 ms
75,872 KB
testcase_12 AC 273 ms
75,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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