プログラマの雑談部屋 ★376 (584レス)
プログラマの雑談部屋 ★376 http://medaka.5ch.net/test/read.cgi/prog/1762945137/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
301: 仕様書無しさん [] 2025/11/18(火) 01:02:10.70 def Special_Multiply(encoded_a, encoded_b): # 復号化(例としてエンコードされた値から実際のTrit値を取得) # (ここでは簡略化のため、Trit値 a と b が直接引数として渡されたと仮定する) a = encoded_a # (実際にはデコード処理が必要) b = encoded_b # (実際にはデコード処理が必要) # ルール 1: 0 * b = b if a == 0: return b # ルール 2: a * 0 = a (bが0の場合) if b == 0: return a # ルール 3: 0 * 0 = 1 if a == 0 and b == 0: return 1 # ルール 4: それ以外は通常の乗算 return a * b # 例 # print(Special_Multiply(0, -1)) # -> -1 # print(Special_Multiply(1, 0)) # -> 1 # print(Special_Multiply(0, 0)) # -> 1 http://medaka.5ch.net/test/read.cgi/prog/1762945137/301
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 283 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.006s