結果
| 問題 | No.2426 Select Plus or Minus |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-18 21:11:43 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 302 bytes |
| 記録 | |
| コンパイル時間 | 2,071 ms |
| コンパイル使用メモリ | 81,456 KB |
| 実行使用メモリ | 56,428 KB |
| 最終ジャッジ日時 | 2026-10-01 06:42:15 |
| 合計ジャッジ時間 | 4,264 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 35 WA * 6 |
ソースコード
N = int(input())
ans = ''
s = set()
while N != 1:
if N % 2 == 0:
N //= 2
ans += '/'
else:
if 3 * N + 1 not in s:
N = 3 * N + 1
ans += '+'
else:
N = 3 * N - 1
ans += '-'
s.add(N)
print(len(ans))
print(ans)