結果

問題 No.2426 Select Plus or Minus
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 22:13:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 72,528 KB
最終ジャッジ日時 2023-08-18 22:13:11
合計ジャッジ時間 8,301 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
72,252 KB
testcase_01 AC 86 ms
72,216 KB
testcase_02 AC 86 ms
71,992 KB
testcase_03 AC 86 ms
72,084 KB
testcase_04 AC 100 ms
72,108 KB
testcase_05 AC 87 ms
72,220 KB
testcase_06 AC 102 ms
72,392 KB
testcase_07 AC 87 ms
72,260 KB
testcase_08 AC 84 ms
71,956 KB
testcase_09 AC 86 ms
72,120 KB
testcase_10 AC 102 ms
71,992 KB
testcase_11 AC 87 ms
72,528 KB
testcase_12 AC 92 ms
71,972 KB
testcase_13 AC 89 ms
72,112 KB
testcase_14 AC 86 ms
72,072 KB
testcase_15 AC 86 ms
72,108 KB
testcase_16 AC 87 ms
72,112 KB
testcase_17 AC 88 ms
72,248 KB
testcase_18 AC 86 ms
72,332 KB
testcase_19 AC 87 ms
72,364 KB
testcase_20 AC 102 ms
72,120 KB
testcase_21 AC 86 ms
71,920 KB
testcase_22 AC 85 ms
72,200 KB
testcase_23 AC 86 ms
72,080 KB
testcase_24 AC 86 ms
72,344 KB
testcase_25 AC 87 ms
72,088 KB
testcase_26 AC 86 ms
72,116 KB
testcase_27 AC 87 ms
72,120 KB
testcase_28 AC 84 ms
72,412 KB
testcase_29 AC 89 ms
72,100 KB
testcase_30 AC 97 ms
72,356 KB
testcase_31 AC 85 ms
72,208 KB
testcase_32 AC 85 ms
72,472 KB
testcase_33 AC 87 ms
72,216 KB
testcase_34 AC 85 ms
72,464 KB
testcase_35 AC 87 ms
72,332 KB
testcase_36 AC 88 ms
72,308 KB
testcase_37 AC 91 ms
72,104 KB
testcase_38 AC 85 ms
72,332 KB
testcase_39 AC 85 ms
72,420 KB
testcase_40 AC 95 ms
72,104 KB
testcase_41 AC 83 ms
72,196 KB
testcase_42 AC 85 ms
72,088 KB
testcase_43 AC 88 ms
72,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

奇数は

1 -> 2 or 4
3 -> 8 or 

"""

import sys
from sys import stdin
import random

N = int(stdin.readline())

ans = []
s = set()

while N != 1:

    s.add(N)

    if N % 2 == 0:
        ans.append("/")
        N //= 2

    elif random.randint(0,1) == 0:
        ans.append("-")
        N = N*3-1
    else:
        ans.append("+")
        N = N*3+1

print (len(ans))
print ("".join(ans))
0