結果

問題 No.2426 Select Plus or Minus
ユーザー ShirotsumeShirotsume
提出日時 2023-08-18 21:09:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 798 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 74,904 KB
最終ジャッジ日時 2023-08-18 21:09:16
合計ジャッジ時間 8,779 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
74,896 KB
testcase_01 AC 127 ms
74,688 KB
testcase_02 AC 119 ms
74,724 KB
testcase_03 AC 119 ms
74,580 KB
testcase_04 AC 121 ms
74,452 KB
testcase_05 AC 120 ms
74,700 KB
testcase_06 AC 119 ms
74,512 KB
testcase_07 AC 122 ms
74,732 KB
testcase_08 AC 123 ms
74,696 KB
testcase_09 AC 120 ms
74,608 KB
testcase_10 AC 121 ms
74,456 KB
testcase_11 AC 120 ms
74,404 KB
testcase_12 AC 118 ms
74,364 KB
testcase_13 AC 124 ms
74,468 KB
testcase_14 AC 122 ms
74,512 KB
testcase_15 AC 119 ms
74,644 KB
testcase_16 AC 121 ms
74,576 KB
testcase_17 AC 121 ms
74,612 KB
testcase_18 AC 120 ms
74,696 KB
testcase_19 AC 117 ms
74,668 KB
testcase_20 AC 115 ms
74,412 KB
testcase_21 AC 118 ms
74,700 KB
testcase_22 AC 124 ms
74,904 KB
testcase_23 AC 120 ms
74,812 KB
testcase_24 AC 123 ms
74,556 KB
testcase_25 AC 121 ms
74,344 KB
testcase_26 AC 120 ms
74,464 KB
testcase_27 AC 120 ms
74,632 KB
testcase_28 AC 124 ms
74,372 KB
testcase_29 AC 119 ms
74,684 KB
testcase_30 AC 118 ms
74,880 KB
testcase_31 AC 118 ms
74,740 KB
testcase_32 AC 120 ms
74,644 KB
testcase_33 AC 123 ms
74,684 KB
testcase_34 AC 118 ms
74,592 KB
testcase_35 AC 118 ms
74,340 KB
testcase_36 AC 120 ms
74,692 KB
testcase_37 AC 119 ms
74,676 KB
testcase_38 AC 122 ms
74,420 KB
testcase_39 AC 123 ms
74,576 KB
testcase_40 AC 124 ms
74,600 KB
testcase_41 AC 120 ms
74,880 KB
testcase_42 AC 121 ms
74,876 KB
testcase_43 AC 120 ms
74,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n = ii()

ans = []
while n != 1:
    if n % 2 == 0:
        ans.append('/')
        n //= 2
    else:
        if random.random() < 0.5:
            ans.append('-')
            n = 3 * n - 1
        else:
            ans.append('+')
            n = 3 * n + 1
print(len(ans))

print(''.join(ans))
0