結果

問題 No.1253 雀見椪
ユーザー trineutrontrineutron
提出日時 2020-10-09 21:54:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 527 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-09-27 16:41:43
合計ジャッジ時間 7,185 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,736 KB
testcase_01 AC 15 ms
7,972 KB
testcase_02 AC 17 ms
7,808 KB
testcase_03 AC 47 ms
7,872 KB
testcase_04 AC 515 ms
7,796 KB
testcase_05 AC 518 ms
7,808 KB
testcase_06 AC 515 ms
7,832 KB
testcase_07 AC 520 ms
7,864 KB
testcase_08 AC 527 ms
7,816 KB
testcase_09 AC 517 ms
7,720 KB
testcase_10 AC 519 ms
7,720 KB
testcase_11 AC 519 ms
7,820 KB
testcase_12 AC 525 ms
7,888 KB
testcase_13 AC 521 ms
7,808 KB
testcase_14 AC 14 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

def solve():
    n, ag, bg, ac, bc, ap, bp = map(int, input().split())
    ag *= pow(bg, mod - 2, mod)
    ag %= mod
    ac *= pow(bc, mod - 2, mod)
    ac %= mod
    ap *= pow(bp, mod - 2, mod)
    ap %= mod
    print((1 - pow(ag + ac, n, mod) - pow(ac + ap, n, mod) - pow(ap + ag, n, mod) + 2 * pow(ag, n, mod) + 2 * pow(ac, n, mod) + 2 * pow(ap, n, mod)) % mod)

t = int(input())
for i in range(t):
    solve()
0