結果

問題 No.2426 Select Plus or Minus
ユーザー moharan627moharan627
提出日時 2023-08-18 22:44:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,010 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 77,172 KB
最終ジャッジ日時 2023-08-18 22:44:17
合計ジャッジ時間 9,247 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,556 KB
testcase_01 AC 94 ms
71,872 KB
testcase_02 AC 101 ms
71,616 KB
testcase_03 AC 100 ms
76,756 KB
testcase_04 AC 102 ms
76,932 KB
testcase_05 AC 96 ms
71,880 KB
testcase_06 AC 96 ms
71,648 KB
testcase_07 AC 104 ms
76,752 KB
testcase_08 AC 103 ms
76,756 KB
testcase_09 AC 103 ms
76,900 KB
testcase_10 AC 104 ms
76,884 KB
testcase_11 AC 102 ms
76,820 KB
testcase_12 AC 103 ms
76,936 KB
testcase_13 AC 102 ms
76,812 KB
testcase_14 AC 113 ms
76,956 KB
testcase_15 AC 103 ms
76,900 KB
testcase_16 AC 96 ms
71,468 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 103 ms
77,112 KB
testcase_21 AC 103 ms
77,060 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 112 ms
76,884 KB
testcase_25 AC 113 ms
77,136 KB
testcase_26 AC 110 ms
77,120 KB
testcase_27 AC 111 ms
76,804 KB
testcase_28 AC 114 ms
77,004 KB
testcase_29 AC 113 ms
77,132 KB
testcase_30 AC 105 ms
71,648 KB
testcase_31 AC 112 ms
77,172 KB
testcase_32 AC 101 ms
77,044 KB
testcase_33 AC 139 ms
76,888 KB
testcase_34 AC 103 ms
77,136 KB
testcase_35 AC 111 ms
76,992 KB
testcase_36 AC 111 ms
76,796 KB
testcase_37 AC 114 ms
76,960 KB
testcase_38 AC 112 ms
77,048 KB
testcase_39 AC 112 ms
76,812 KB
testcase_40 AC 95 ms
71,464 KB
testcase_41 AC 99 ms
76,920 KB
testcase_42 AC 103 ms
76,800 KB
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10**9 + 7
MOD2 = 998244353
from collections import defaultdict
def ceil(A,B):
    return -(-A//B)
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(sys.stdin.readline().rstrip())
    def IC(): return [int(c) for c in sys.stdin.readline().rstrip()]
    def MI(): return map(int, sys.stdin.readline().split())
    N =II()
    n = N
    Ans = []
    while(N!=1):
        if(N%2==0):
            N//=2
            Ans.append("/")
        else:
            N = 3*N+1
            Ans.append("+")
    Ans2 = []
    while(n!=1 and len(Ans2)<=10000):
        if(n%2==0):
            n//=2
            Ans2.append("/")
        else:
            n=3*n-1
            Ans2.append("-")
    if(n==1 and len(Ans2)<=10000):
        print(len(Ans2))
        print(*Ans2,sep="")
    else:
        print(len(Ans))
        print(*Ans,sep="")
    return
solve()
0