結果
問題 | No.3157 Nabeatsu |
ユーザー |
|
提出日時 | 2025-05-27 14:32:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,229 ms / 2,000 ms |
コード長 | 656 bytes |
コンパイル時間 | 453 ms |
コンパイル使用メモリ | 83,032 KB |
実行使用メモリ | 176,700 KB |
最終ジャッジ日時 | 2025-05-27 14:33:07 |
合計ジャッジ時間 | 7,107 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
import sys sys.set_int_max_str_digits(0) N = input() for _ in range(2): ans = ['9'] * len(N) res = 9 * len(N) for i, n in enumerate(N): if n == '3': res -= 7 ans[i] = '2' break else: res -= 9 - int(n) ans[i] = n if res % 3 == 0: if ans[-1] == '0': ans = int(''.join(ans)) ans -= 1 else: ans[-1] = str(int(ans[-1]) - 1) if ans[-1] == '3': ans[-1] = '2' ans = ''.join(ans) break else: ans = ''.join(ans) break N = str(ans) print(ans)