結果

問題 No.1966 Median of Divisors
ユーザー titiatitia
提出日時 2022-06-03 21:54:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,935 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 11,816 KB
実行使用メモリ 10,048 KB
最終ジャッジ日時 2023-10-21 01:49:50
合計ジャッジ時間 13,093 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,032 KB
testcase_01 AC 30 ms
10,032 KB
testcase_02 AC 41 ms
10,036 KB
testcase_03 AC 43 ms
10,036 KB
testcase_04 AC 1,649 ms
10,048 KB
testcase_05 AC 1,935 ms
10,048 KB
testcase_06 AC 1,933 ms
10,048 KB
testcase_07 AC 214 ms
10,048 KB
testcase_08 AC 1,187 ms
10,048 KB
testcase_09 AC 1,573 ms
10,048 KB
testcase_10 AC 1,564 ms
10,048 KB
testcase_11 AC 721 ms
10,048 KB
testcase_12 AC 947 ms
10,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
    
T=int(input())

for tests in range(T):
    N,M=map(int,input().split())

    x=pow(N,M,mod)


    ANS=x*(x+1)*pow(2,mod-2,mod)

    y=pow(N,M//2,mod)

    ANS-=y*(y+1)*(2*y+1)*pow(6,mod-2,mod)

    print(ANS%mod)
0