結果

問題 No.1253 雀見椪
ユーザー shotoyooshotoyoo
提出日時 2020-10-09 22:18:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 77,920 KB
最終ジャッジ日時 2023-09-27 17:54:20
合計ジャッジ時間 4,648 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,236 KB
testcase_01 AC 64 ms
71,384 KB
testcase_02 AC 69 ms
71,220 KB
testcase_03 AC 115 ms
76,952 KB
testcase_04 AC 290 ms
77,668 KB
testcase_05 AC 292 ms
77,568 KB
testcase_06 AC 288 ms
77,808 KB
testcase_07 AC 292 ms
77,920 KB
testcase_08 AC 295 ms
77,616 KB
testcase_09 AC 291 ms
77,764 KB
testcase_10 AC 285 ms
77,872 KB
testcase_11 AC 291 ms
77,616 KB
testcase_12 AC 289 ms
77,616 KB
testcase_13 AC 290 ms
77,656 KB
testcase_14 AC 68 ms
71,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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