結果

問題 No.1181 Product Sum for All Subsets
ユーザー chielochielo
提出日時 2020-08-21 22:37:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 180 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 75,520 KB
最終ジャッジ日時 2024-04-23 06:13:58
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,200 KB
testcase_01 AC 38 ms
52,072 KB
testcase_02 AC 42 ms
59,080 KB
testcase_03 AC 39 ms
52,196 KB
testcase_04 AC 37 ms
52,964 KB
testcase_05 AC 36 ms
53,020 KB
testcase_06 AC 36 ms
52,340 KB
testcase_07 AC 36 ms
52,132 KB
testcase_08 AC 38 ms
53,288 KB
testcase_09 AC 37 ms
52,648 KB
testcase_10 AC 37 ms
52,452 KB
testcase_11 AC 36 ms
52,776 KB
testcase_12 AC 104 ms
75,188 KB
testcase_13 AC 57 ms
74,924 KB
testcase_14 AC 102 ms
75,124 KB
testcase_15 AC 93 ms
74,852 KB
testcase_16 AC 107 ms
75,092 KB
testcase_17 AC 70 ms
75,044 KB
testcase_18 AC 101 ms
75,520 KB
testcase_19 AC 95 ms
75,412 KB
testcase_20 AC 110 ms
75,160 KB
testcase_21 AC 82 ms
75,144 KB
testcase_22 AC 71 ms
75,092 KB
testcase_23 AC 54 ms
72,356 KB
testcase_24 AC 67 ms
75,420 KB
testcase_25 AC 83 ms
75,232 KB
testcase_26 AC 46 ms
62,872 KB
testcase_27 AC 36 ms
52,608 KB
testcase_28 AC 115 ms
75,136 KB
testcase_29 AC 59 ms
75,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
mo = 10 ** 9 + 7
a, b = 1, 1
for _ in range(n):
    a = (a * k + a * (1 + k) * k // 2) % mo
    b = (b * (1 + k) * k // 2) % mo
print((a - b) % mo)
0