結果

問題 No.1253 雀見椪
ユーザー marroncastlemarroncastle
提出日時 2020-10-09 22:18:31
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 77,980 KB
最終ジャッジ日時 2023-09-27 17:55:09
合計ジャッジ時間 5,604 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,412 KB
testcase_01 AC 66 ms
71,184 KB
testcase_02 AC 63 ms
71,248 KB
testcase_03 AC 108 ms
75,908 KB
testcase_04 AC 403 ms
77,756 KB
testcase_05 AC 411 ms
77,656 KB
testcase_06 AC 400 ms
77,580 KB
testcase_07 AC 404 ms
77,928 KB
testcase_08 AC 392 ms
77,552 KB
testcase_09 AC 395 ms
77,588 KB
testcase_10 AC 409 ms
77,980 KB
testcase_11 AC 393 ms
77,628 KB
testcase_12 AC 396 ms
77,596 KB
testcase_13 AC 411 ms
77,792 KB
testcase_14 AC 69 ms
71,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
T = int(input())
ans = [0]*T
mod = 10**9+7
for t in range(T):
  N, AG, BG, AC, BC, AP, BP = map(int, input().split())
  M = BG*BC*BP
  AG *= BC*BP
  AC *= BG*BP
  AP *= BC*BG
  ans[t] = pow(M,N,mod)
  ans[t] -= pow(AG+AC,N,mod)+pow(AG+AP,N,mod)+pow(AC+AP,N,mod)
  ans[t] += pow(AG,N,mod)*2+pow(AC,N,mod)*2+pow(AP,N,mod)*2
  ans[t] *= pow(M,N*(mod-2),mod)
  ans[t] %= mod
print(*ans, sep='\n')
0