結果

問題 No.1966 Median of Divisors
ユーザー googol_S0googol_S0
提出日時 2022-06-03 21:31:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-10-21 01:39:01
合計ジャッジ時間 5,025 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,352 KB
testcase_01 AC 36 ms
53,352 KB
testcase_02 AC 53 ms
60,988 KB
testcase_03 AC 67 ms
65,804 KB
testcase_04 AC 450 ms
77,092 KB
testcase_05 AC 523 ms
77,080 KB
testcase_06 AC 506 ms
76,956 KB
testcase_07 AC 125 ms
77,008 KB
testcase_08 AC 349 ms
77,092 KB
testcase_09 AC 436 ms
77,092 KB
testcase_10 AC 439 ms
77,092 KB
testcase_11 AC 240 ms
77,080 KB
testcase_12 AC 293 ms
77,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
def f1(x):
  return (x*(x+1)//2)%mod

def f2(x):
  return (x*(x+1)%mod)*(2*x+1)%mod*pow(6,mod-2,mod)%mod

for t in range(int(input())):
  N,M=map(int,input().split())
  print((f1(pow(N,M,mod))-f2(pow(N,M//2,mod)))%mod)
0