結果

問題 No.2426 Select Plus or Minus
ユーザー taro2023
提出日時 2023-08-18 22:22:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 493 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-28 08:06:09
合計ジャッジ時間 6,078 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 8 WA * 1 RE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

a=int(input())
global i
def c(b,result=None,i=0):
    if result is None:
        result=[]
    if b==1:
        return result,i
    else:
        if b%2==0:
            b=b/2
            result.append("/")
            i+=1
        else:
            if b!=a:
                b=3*b-1
                result.append("-")
                i+=1
            else:
                b=3*b+1
                result.append("+")
                i+=1
        return c(b,result,i)
d,e=c(a)
print(e)
print(*d)
0