結果

問題 No.2426 Select Plus or Minus
ユーザー tassei903tassei903
提出日時 2023-08-15 04:58:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 54,608 KB
最終ジャッジ日時 2024-05-05 09:47:21
合計ジャッジ時間 4,048 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,020 KB
testcase_01 AC 40 ms
52,688 KB
testcase_02 AC 38 ms
52,096 KB
testcase_03 AC 38 ms
52,068 KB
testcase_04 AC 38 ms
52,924 KB
testcase_05 WA -
testcase_06 AC 38 ms
52,364 KB
testcase_07 AC 39 ms
52,816 KB
testcase_08 AC 39 ms
53,120 KB
testcase_09 AC 38 ms
52,788 KB
testcase_10 AC 40 ms
53,508 KB
testcase_11 AC 37 ms
53,424 KB
testcase_12 AC 38 ms
52,500 KB
testcase_13 AC 38 ms
53,136 KB
testcase_14 AC 37 ms
53,356 KB
testcase_15 AC 37 ms
52,772 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 39 ms
52,868 KB
testcase_20 AC 37 ms
53,600 KB
testcase_21 AC 37 ms
52,824 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 38 ms
52,504 KB
testcase_25 AC 39 ms
53,088 KB
testcase_26 AC 38 ms
52,276 KB
testcase_27 AC 38 ms
53,368 KB
testcase_28 AC 38 ms
53,816 KB
testcase_29 AC 37 ms
53,040 KB
testcase_30 AC 35 ms
52,888 KB
testcase_31 AC 37 ms
52,620 KB
testcase_32 AC 37 ms
53,088 KB
testcase_33 AC 38 ms
52,552 KB
testcase_34 AC 38 ms
52,392 KB
testcase_35 AC 37 ms
52,452 KB
testcase_36 AC 37 ms
52,992 KB
testcase_37 AC 36 ms
52,564 KB
testcase_38 AC 36 ms
54,204 KB
testcase_39 AC 37 ms
53,496 KB
testcase_40 AC 37 ms
52,204 KB
testcase_41 AC 37 ms
53,088 KB
testcase_42 AC 36 ms
52,904 KB
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

ans = []
def f(n, d):
    if d >= 10**4:
        return -1
    elif n == 1:
        print(len(ans))
        print("".join(ans))
        exit()
    if n % 2:
        ans.append("+")
        f(n * 3 + 1, d+1)
        ans.pop()
        ans.append("-")
        f(n * 3 - 1, d+1)
        ans.pop()
    else:
        ans.append("/")
        f(n//2, d+1)
        ans.pop()

f(int(input()), 0)
0