結果
| 問題 | No.3462 Buttons |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-27 10:12:54 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 927 bytes |
| 記録 | |
| コンパイル時間 | 1,074 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-02-28 13:12:44 |
| 合計ジャッジ時間 | 36,950 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 5 TLE * 10 |
ソースコード
for _ in range(int(input())):
a, b, k = map(int, input().split())
mod = 998244353
if b == 1 or b == 0:
print(max(a, 0) * k % mod)
continue
if b == -1:
if a >= 0:
print(a * k % mod)
else:
print(- a * (k - 1) % mod)
continue
if a < 0:
if b > 0:
print(0)
else:
if k == 1:
print(0)
else:
if k % 2 == 0:
print(- a * pow(-b, k-1, mod) % mod)
else:
print(- 2 * a * pow(-b, k-2, mod) % mod)
else:
if b > 0:
print(a * pow(b, k-1, mod) % mod)
else:
if k == 1:
print(a)
else:
if k % 2 == 0:
print(a * pow(-b, k-1, mod) % mod)
else:
print(2 * a * pow(-b, k-2, mod) % mod)