結果

問題 No.1253 雀見椪
ユーザー flippergoflippergo
提出日時 2020-12-26 14:07:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,622 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 85,888 KB
最終ジャッジ日時 2023-10-24 22:00:29
合計ジャッジ時間 18,820 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,360 KB
testcase_01 AC 46 ms
61,544 KB
testcase_02 AC 91 ms
75,388 KB
testcase_03 AC 207 ms
75,984 KB
testcase_04 AC 1,578 ms
85,888 KB
testcase_05 AC 1,483 ms
83,632 KB
testcase_06 AC 1,486 ms
84,352 KB
testcase_07 AC 1,543 ms
83,452 KB
testcase_08 AC 1,535 ms
83,972 KB
testcase_09 AC 1,622 ms
84,680 KB
testcase_10 AC 1,482 ms
83,340 KB
testcase_11 AC 1,486 ms
83,980 KB
testcase_12 AC 1,502 ms
83,512 KB
testcase_13 AC 1,559 ms
83,232 KB
testcase_14 AC 49 ms
61,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
T = int(input())
for _ in range(T):
    N,AG,BG,AC,BC,AP,BP = map(int,input().split())
    S = 1
    S = (S+2*pow(AG,N)*pow(pow(BG,N),p-2))%p
    S = (S+2*pow(AC,N)*pow(pow(BC,N),p-2))%p
    S = (S+2*pow(AP,N)*pow(pow(BP,N),p-2))%p
    S = (S-pow(BG-AG,N)*pow(pow(BG,N),p-2))%p
    S = (S-pow(BC-AC,N)*pow(pow(BC,N),p-2))%p
    S = (S-pow(BP-AP,N)*pow(pow(BP,N),p-2))%p
    print(S)
0