結果

問題 No.1253 雀見椪
コンテスト
ユーザー shotoyoo
提出日時 2020-10-09 22:18:20
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 540 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 121 ms
コンパイル使用メモリ 85,456 KB
実行使用メモリ 138,760 KB
最終ジャッジ日時 2026-04-02 23:39:12
合計ジャッジ時間 2,191 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


t = int(input())
for _ in range(t):
    n,a0,b0,a1,b1,a2,b2 = list(map(int, input().split()))
    a = [a0,a1,a2]
    b = [b0,b1,b2]
    ans = 0
    M = 10**9+7
    for i in range(3):
        ans += 2* pow(a[i], n, M) * pow(pow(b[i], M-2, M), n, M)
        ans %= M
    ans += 1
    for i in range(3):
        ans -= pow((b[i]-a[i]), n, M) * pow(pow(b[i], M-2, M), n, M)
    ans %= M
    print(ans)
0