結果

問題 No.1253 雀見椪
ユーザー 37zigen37zigen
提出日時 2020-10-09 22:17:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 739 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-09-27 17:52:26
合計ジャッジ時間 8,604 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,804 KB
testcase_01 AC 13 ms
7,792 KB
testcase_02 AC 17 ms
7,936 KB
testcase_03 AC 58 ms
7,800 KB
testcase_04 AC 725 ms
7,808 KB
testcase_05 AC 719 ms
7,856 KB
testcase_06 AC 714 ms
7,868 KB
testcase_07 AC 718 ms
7,900 KB
testcase_08 AC 722 ms
7,868 KB
testcase_09 AC 739 ms
7,832 KB
testcase_10 AC 728 ms
7,992 KB
testcase_11 AC 718 ms
7,968 KB
testcase_12 AC 736 ms
7,796 KB
testcase_13 AC 738 ms
7,948 KB
testcase_14 AC 15 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=10**9+7
def inv(a):
    return pow(a,M-2,M)

T=int(input())
for t in range(T):
    n,ag,bg,ac,bc,ap,bp=map(int,input().split())
    prob=[ag*inv(bg),ac*inv(bc),ap*inv(bp)]
    anti=0
    for i in range(3):
        anti+=pow(1-prob[i],n,M)-pow(prob[(i+1)%3],n,M)-pow(prob[(i+2)%3],n,M)
    print((1-anti)%M)
0