結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,376 KB
testcase_01 AC 46 ms
60,308 KB
testcase_02 AC 83 ms
75,280 KB
testcase_03 AC 185 ms
75,820 KB
testcase_04 AC 788 ms
78,716 KB
testcase_05 AC 830 ms
80,644 KB
testcase_06 AC 828 ms
80,352 KB
testcase_07 AC 788 ms
78,784 KB
testcase_08 AC 869 ms
80,024 KB
testcase_09 AC 777 ms
78,704 KB
testcase_10 AC 781 ms
78,628 KB
testcase_11 AC 927 ms
81,180 KB
testcase_12 AC 780 ms
78,768 KB
testcase_13 AC 781 ms
78,656 KB
testcase_14 AC 45 ms
59,568 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())
    n = N%(p-1)
    S = 1
    a = pow(BG,n)
    b = pow(BC,n)
    c = pow(BP,n)
    S = (S+2*pow(AG,n)*pow(a,p-2))%p
    S = (S+2*pow(AC,n)*pow(b,p-2))%p
    S = (S+2*pow(AP,n)*pow(c,p-2))%p
    S = (S-pow(BG-AG,n)*pow(a,p-2))%p
    S = (S-pow(BC-AC,n)*pow(b,p-2))%p
    S = (S-pow(BP-AP,n)*pow(c,p-2))%p
    print(S)
0