結果

問題 No.1253 雀見椪
ユーザー wattaiheiwattaihei
提出日時 2020-10-09 22:29:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,372 KB
実行使用メモリ 78,992 KB
最終ジャッジ日時 2023-09-27 18:17:26
合計ジャッジ時間 4,299 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,360 KB
testcase_01 AC 68 ms
71,260 KB
testcase_02 AC 71 ms
71,288 KB
testcase_03 AC 94 ms
76,100 KB
testcase_04 AC 255 ms
78,992 KB
testcase_05 AC 243 ms
78,788 KB
testcase_06 AC 243 ms
78,984 KB
testcase_07 AC 246 ms
78,976 KB
testcase_08 AC 240 ms
78,984 KB
testcase_09 AC 248 ms
78,888 KB
testcase_10 AC 241 ms
78,672 KB
testcase_11 AC 242 ms
78,796 KB
testcase_12 AC 242 ms
78,912 KB
testcase_13 AC 241 ms
78,784 KB
testcase_14 AC 68 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

mod = 10**9+7

T = int(input())
Query = [list(map(int, input().split())) for _ in range(T)]

for n, ag, bg, ac, bc, ap, bp in Query:
    pg = ag * pow(bg, mod-2, mod) % mod
    pc = ac * pow(bc, mod-2, mod) % mod
    pp = ap * pow(bp, mod-2, mod) % mod
    p1 = pow(pg+pc, n, mod) - pow(pg, n, mod) - pow(pc, n, mod)
    p2 = pow(pc+pp, n, mod) - pow(pc, n, mod) - pow(pp, n, mod)
    p3 = pow(pp+pg, n, mod) - pow(pp, n, mod) - pow(pg, n, mod)
    print((1 - p1 - p2 - p3 ) % mod)
0