結果
| 問題 |
No.1253 雀見椪
|
| コンテスト | |
| ユーザー |
r_ishida
|
| 提出日時 | 2020-12-30 10:16:21 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 919 ms / 2,000 ms |
| コード長 | 787 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-06 21:07:08 |
| 合計ジャッジ時間 | 10,717 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 |
ソースコード
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
t = I()
MOD = 10**9+7
for _ in range(t):
n, ag, bg, ac, bc, ap, bp = MI()
g1 = pow(bg-ag, n, MOD)
g0 = pow(bg,n,MOD)
g2 = pow(g0, MOD-2, MOD)
c1 = pow(bc-ac, n, MOD)
c0 = pow(bc,n,MOD)
c2 = pow(c0, MOD-2, MOD)
p1 = pow(bp-ap, n, MOD)
p0 = pow(bp,n,MOD)
p2 = pow(p0, MOD-2, MOD)
ans = 1-(g1*g2)%MOD-(c1*c2)%MOD-(p1*p2)%MOD+2*pow(ag,n, MOD)*g2+2*pow(ac,n, MOD)*c2+2*pow(ap,n, MOD)*p2
ans %= MOD
print(ans)
r_ishida