結果

問題 No.1253 雀見椪
ユーザー 👑 tamatotamato
提出日時 2020-10-09 21:38:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 87,620 KB
実行使用メモリ 77,988 KB
最終ジャッジ日時 2023-09-27 15:41:09
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,476 KB
testcase_01 AC 73 ms
71,820 KB
testcase_02 AC 73 ms
71,524 KB
testcase_03 AC 92 ms
75,936 KB
testcase_04 AC 216 ms
77,896 KB
testcase_05 AC 216 ms
77,988 KB
testcase_06 AC 217 ms
77,920 KB
testcase_07 AC 217 ms
77,888 KB
testcase_08 AC 215 ms
77,908 KB
testcase_09 AC 216 ms
77,860 KB
testcase_10 AC 217 ms
77,816 KB
testcase_11 AC 217 ms
77,948 KB
testcase_12 AC 216 ms
77,572 KB
testcase_13 AC 218 ms
77,576 KB
testcase_14 AC 73 ms
71,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    for _ in range(int(input())):
        N, ag, bg, ac, bc, ap, bp = map(int, input().split())
        g = ag * pow(bg, mod-2, mod)
        c = ac * pow(bc, mod-2, mod)
        p = ap * pow(bp, mod-2, mod)
        print((1 - pow(g + c, N, mod) - pow(c + p, N, mod) - pow(p + g, N, mod)
              + ((pow(g, N, mod) + pow(c, N, mod) + pow(p, N, mod))%mod * 2)%mod)%mod)


if __name__ == '__main__':
    main()
0