結果
| 問題 | 
                            No.1578 A × B × C
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-07-02 22:18:42 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 370 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 429,088 KB | 
| 最終ジャッジ日時 | 2024-06-29 11:56:49 | 
| 合計ジャッジ時間 | 3,646 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 TLE * 1 | 
| other | -- * 22 | 
ソースコード
MOD = 10**9 + 7
A,B,C = [int(i)%MOD for i in input().split()]
K = int(input())
order = [(A,B,C)]
count = {(A,B,C)}
for i in range(K):
    A,B,C = (B*C)%MOD, (A*C)%MOD, (A*B)%MOD
    tup = (A,B,C)
    if tup in count:
        order = order[order.index(tup):]
        break
    order.append(tup)
    count.add(tup)
A,B,C = order[K % len(order)]
print((((A*B)%MOD)*C)%MOD)