結果
| 問題 | No.2426 Select Plus or Minus |
| コンテスト | |
| ユーザー |
taro2023
|
| 提出日時 | 2023-08-18 22:26:12 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 533 bytes |
| 記録 | |
| コンパイル時間 | 538 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 405,052 KB |
| 最終ジャッジ日時 | 2026-05-22 10:17:06 |
| 合計ジャッジ時間 | 4,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 TLE * 1 -- * 39 |
ソースコード
import sys
sys.setrecursionlimit(10**6)
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)
taro2023