結果

問題 No.1181 Product Sum for All Subsets
ユーザー jensenjensen
提出日時 2021-01-08 22:59:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 7,872 KB
最終ジャッジ日時 2023-08-10 11:19:26
合計ジャッジ時間 2,494 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,732 KB
testcase_01 AC 16 ms
7,744 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,744 KB
testcase_04 AC 16 ms
7,744 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,816 KB
testcase_07 AC 16 ms
7,808 KB
testcase_08 AC 16 ms
7,720 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 15 ms
7,872 KB
testcase_12 AC 16 ms
7,872 KB
testcase_13 AC 16 ms
7,748 KB
testcase_14 AC 16 ms
7,732 KB
testcase_15 AC 16 ms
7,780 KB
testcase_16 AC 16 ms
7,744 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 16 ms
7,812 KB
testcase_20 WA -
testcase_21 AC 16 ms
7,712 KB
testcase_22 WA -
testcase_23 AC 16 ms
7,712 KB
testcase_24 AC 16 ms
7,804 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 17 ms
7,736 KB
testcase_28 WA -
testcase_29 AC 17 ms
7,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

[n,k]=list(map(int,input().split()))

def myPow(a,b,c):
    rootB=int(b**0.5)
    amari=b-rootB**2
    a1=1
    a2=1
    a3=1
    ans=1
    for i in range(0,rootB):
        a1*=a
        a1=a1%c
    for i in range(0,rootB):
        a2*=a1
        a2=a2%c
    for i in range(0,amari):
        a3*=a
        a3=a3%c
    return a2*a3%c

k=k%1000000007
kp=k*(k+3)%1000000007
kq=k*(k+1)%1000000007
if(kp%2!=0):
    kp+=1000000007
if(kq%2!=0):
    kq+=1000000007
p=int(kp/2)
q=int(kq/2)
print(myPow(p,n,1000000007)-myPow(q,n,1000000007))
0