空白、153バイト
[S S S N
_Push_0][S N
S _Duplicate_0][T N
T T _Read_STDIN_as_integer][T T T _Retrieve_input][S N
S _Duplicate_input][N
S S N
_Create_Label_OUTER_LOOP][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][N
T S S N
_If_0_Jump_to_Label_PRINT][S S S N
_Push_0][S N
S _Duplicate_0][T T T _Retrieve_input][N
S S T N
_Create_Label_INNER_LOOP][S N
S _Duplicate][N
T S S S N
_If_0_Jump_to_Label_AFTER_INNER_LOOP][S N
T _Swap_top_two][S T S S T N
_Copy_1st_item_to_top][S T S S T T N
_Copy_3rd_item_to_top][T S T T _Modulo][T S S S _Add][S N
T _Swap_top_two][S T S S T S N
_Copy_2nd_item_to_top][T S T S _Integer_divide][N
S N
T N
_Jump_to_Label_INNER_LOOP][N
S S S S N
_Create_Label_AFTER_INNER_LOOP][S N
N
_Discard_top][S T S S T S N
_Copy_2nd_item_to_top][T S S S _Add][S N
T _Swap_top_two][S S S T N
_Push_1][T S S T _Subtract][N
S N
N
_Jump_to_Label_OUTER_LOOP][N
S S S N
_Create_Label_PRINT][S N
N
_Discard_top][T N
S T _Print_as_integer]
強調表示としてのみ追加される文字S
(スペース)、T
(タブ)、およびN
(改行)。
[..._some_action]
説明としてのみ追加。
オンラインで試してください(未加工のスペース、タブ、改行のみ)。
ホワイトスペースにはベース変換ビルトインがまったくないため、私のJava 8の回答のポートです。
実行例: input = 3
Command Explanation Stack Heap STDIN STDOUT STDERR
SSSN Push 0 [0]
SNS Duplicate 0 [0,0]
TNTT Read STDIN as integer [0] {0:3} 3
TTT Retrieve input from heap 0 [3] {0:3}
SNS Duplicate 3 [3,3] {0:3}
NSSN Create Label_OUTER_LOOP [3,3] {0:3}
SNS Duplicate 3 [3,3,3] {0:3}
SSSTN Push 1 [3,3,3,1] {0:3}
TSST Subtract (3-1) [3,3,2] {0:3}
NTSSN If 0: Jump to Label_PRINT [3,3] {0:3}
SSSN Push 0 [3,3,0] {0:3}
SNS Duplicate 0 [3,3,0,0] {0:3}
TTT Retrieve input from heap 0 [3,3,0,3] {0:3}
NSSTN Create Label_INNER_LOOP [3,3,0,3] {0:3}
SNS Duplicate 3 [3,3,0,3,3] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,3,0,3] {0:3}
SNT Swap top two [3,3,3,0] {0:3}
STSSTN Copy (0-indexed) 1st [3,3,3,0,3] {0:3}
STSSTTN Copy (0-indexed) 3rd [3,3,3,0,3,3] {0:3}
TSTT Modulo (3%3) [3,3,3,0,0] {0:3}
TSSS Add (0+0) [3,3,3,0] {0:3}
SNT Swap top two [3,3,0,3] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,3,0,3,3] {0:3}
TSTS Integer divide (3/3) [3,3,0,1] {0:3}
NSNTN Jump to LABEL_INNER_LOOP [3,3,0,1] {0:3}
SNS Duplicate 1 [3,3,0,1,1] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,3,0,1] {0:3}
SNT Swap top two [3,3,1,0] {0:3}
STSSTN Copy (0-indexed) 1st [3,3,1,0,1] {0:3}
STSSTTN Copy (0-indexed) 3rd [3,3,1,0,1,3] {0:3}
TSTT Modulo (1%3) [3,3,1,0,1] {0:3}
TSSS Add (0+1) [3,3,1,1] {0:3}
SNT Swap top two [3,3,1,1] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,3,1,1,3] {0:3}
TSTS Integer divide (1/3) [3,3,1,0] {0:3}
NSNTN Jump to LABEL_INNER_LOOP [3,3,1,0] {0:3}
SNS Duplicate 0 [3,3,1,0,0] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,3,1,0] {0:3}
NSSSSN Create Label_AFTER_IL [3,3,1,0] {0:3}
SNN Discard top [3,3,1] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,3,1,3] {0:3}
TSSS Add (1+3) [3,3,4] {0:3}
SNT Swap top two [3,4,3] {0:3}
SSSTN Push 1 [3,4,3,1] {0:3}
TSST Subtract (3-1) [3,4,2] {0:3}
NSNN Jump to LABEL_OUTER_LOOP [3,4,2] {0:3}
SNS Duplicate 2 [3,4,2,2] {0:3}
SSSTN Push 1 [3,4,2,2,1] {0:3}
TSST Subtract (2-1) [3,4,2,1] {0:3}
NTSSN If 0: Jump to Label_PRINT [3,4,2] {0:3}
SSSN Push 0 [3,4,2,0] {0:3}
SNS Duplicate 0 [3,4,2,0,0] {0:3}
TTT Retrieve input from heap 0 [3,4,2,0,3] {0:3}
NSSTN Create Label_INNER_LOOP [3,4,2,0,3] {0:3}
SNS Duplicate 3 [3,4,2,0,3,3] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,4,2,0,3] {0:3}
SNT Swap top two [3,4,2,3,0] {0:3}
STSSTN Copy (0-indexed) 1st [3,4,2,3,0,3] {0:3}
STSSTTN Copy (0-indexed) 3rd [3,4,2,3,0,3,2] {0:3}
TSTT Modulo (3%2) [3,4,2,3,0,1] {0:3}
TSSS Add (0+1) [3,4,2,3,1] {0:3}
SNT Swap top two [3,4,2,1,3] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,4,2,1,3,2] {0:3}
TSTS Integer divide (3/2) [3,4,2,1,1] {0:3}
NSNTN Jump to LABEL_INNER_LOOP [3,4,2,1,1] {0:3}
SNS Duplicate 1 [3,4,2,1,1,1] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,4,2,1,1] {0:3}
SNT Swap top two [3,4,2,1,1] {0:3}
STSSTN Copy (0-indexed) 1st [3,4,2,1,1,1] {0:3}
STSSTTN Copy (0-indexed) 3rd [3,4,2,1,1,1,2] {0:3}
TSTT Modulo (1%2) [3,4,2,1,1,1] {0:3}
TSSS Add (1+1) [3,4,2,1,2] {0:3}
SNT Swap top two [3,4,2,2,1] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,4,2,2,1,2] {0:3}
TSTS Integer divide (1/2) [3,4,2,2,0] {0:3}
NSNTN Jump to LABEL_INNER_LOOP [3,4,2,2,0] {0:3}
SNS Duplicate 0 [3,4,2,2,0,0] {0:3}
NTSSSN If 0: Jump to Label_AFTER_IL [3,4,2,2,0] {0:3}
NSSSSN Create Label_AFTER_IL [3,4,2,2,0] {0:3}
SNN Discard top [3,4,2,2] {0:3}
STSSTSN Copy (0-indexed) 2nd [3,4,2,2,4] {0:3}
TSSS Add (2+4) [3,4,2,6] {0:3}
SNT Swap top two [3,4,6,2] {0:3}
SSSTN Push 1 [3,4,6,2,1] {0:3}
TSST Subtract (2-1) [3,4,6,1] {0:3}
NSNN Jump to LABEL_OUTER_LOOP [3,4,6,1] {0:3}
SNS Duplicate 1 [3,4,6,1,1] {0:3}
SSSTN Push 1 [3,4,6,1,1,1] {0:3}
TSST Subtract (1-1) [3,4,6,1,0] {0:3}
NTSSN If 0: Jump to Label_PRINT [3,4,6,1] {0:3}
NSSSSN Create Label_PRINT [3,4,6,1] {0:3}
SNN Discard top [3,4,6] {0:3}
TNST Print top (6) to STDOUT as int [3,4] {0:3} 6
error
プログラムはエラーで停止します:出口が見つかりません。(このNNN
エラーを取り除くために、3つの末尾の改行を追加できました。)
227 -> 9999
。そしてまた:1383 -> 345678
。