結果

問題 No.1105 Many Triplets
ユーザー qumazaki
提出日時 2020-07-04 02:57:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 54,024 KB
最終ジャッジ日時 2024-09-17 07:30:57
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a,b,c = map(int,input().split())
mod = 10**9 + 7

n -= 2
a,b,c = a-b,b-c,c-a

k = n//6
l = n%6

k_mul = pow(-27,k,mod)
a = (a*k_mul)%mod
b = (b*k_mul)%mod
c = (c*k_mul)%mod

for _ in range(l):
    a,b,c = a-b,b-c,c-a

print(' '.join(map(lambda x: str(x%mod),[a,b,c])))
0