結果
問題 | No.1966 Median of Divisors |
ユーザー |
|
提出日時 | 2022-06-03 22:38:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 420 ms / 2,000 ms |
コード長 | 293 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 77,312 KB |
最終ジャッジ日時 | 2024-09-21 03:02:33 |
合計ジャッジ時間 | 4,374 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 |
ソースコード
import sys input = sys.stdin.readline from collections import * MOD = 10**9+7 inv = lambda x: pow(x, MOD-2, MOD) for _ in range(int(input())): N, M = map(int, input().split()) x = pow(N, M, MOD) y = pow(N, M//2, MOD) print((x*(1+x)*inv(2)%MOD-y*(y+1)*(2*y+1)*inv(6)%MOD)%MOD)