結果
問題 | No.2426 Select Plus or Minus |
ユーザー |
![]() |
提出日時 | 2023-08-18 21:29:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 82,208 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-11-28 05:42:53 |
合計ジャッジ時間 | 3,858 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
def f(x):c = 0while x % 2 == 0:c += 1x //= 2return cN = int(input())c = []while N != 1:if N % 2 == 0:N //= 2c.append('/')elif f(3*N+1) > f(3*N-1):N = 3*N+1c.append('+')else:N = 3*N-1c.append('-')print(len(c))print(''.join(c))