結果

問題 No.1966 Median of Divisors
ユーザー tassei903tassei903
提出日時 2022-06-03 22:00:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 1,423 ms
コンパイル使用メモリ 81,308 KB
実行使用メモリ 75,944 KB
最終ジャッジ日時 2023-10-21 01:51:59
合計ジャッジ時間 4,247 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,260 KB
testcase_01 AC 40 ms
53,260 KB
testcase_02 AC 50 ms
60,672 KB
testcase_03 AC 57 ms
63,516 KB
testcase_04 AC 281 ms
75,944 KB
testcase_05 AC 369 ms
75,876 KB
testcase_06 AC 307 ms
75,616 KB
testcase_07 AC 97 ms
75,752 KB
testcase_08 AC 211 ms
75,868 KB
testcase_09 AC 257 ms
75,920 KB
testcase_10 AC 261 ms
75,916 KB
testcase_11 AC 181 ms
75,720 KB
testcase_12 AC 210 ms
75,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

mod = 10**9+7
for _ in range(ni()):
    n, m = na()
    m//=2
    X = pow(n,m,mod)
    A = (1 + pow(n, 2*m, mod))*pow(n, 2*m, mod)//2%mod
    B = X*(X+1)*(2*X+1)//6%mod
    print((A-B)%mod)
0