結果

問題 No.2426 Select Plus or Minus
ユーザー Akijin_007
提出日時 2023-08-18 21:23:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 51,712 KB
最終ジャッジ日時 2024-11-28 05:32:05
合計ジャッジ時間 3,686 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

N = int(input())
ans = ""
m = 0

while N != 1:
    m += 1
    if N % 2 == 0:
        ans += "/"
        N //= 2
    elif N % 4 == 3:
        ans += "-"
        N = (3*N - 1)
    else:
        ans += "+"
        N = (3*N + 1)
    # print(m, N)

print(m)
print(ans)





0