un2bin.dsc

来自「The program simulates a Nondeterministic」· DSC 代码 · 共 29 行

DSC
29
字号
Conversion unary representation of a number to binary one.

Source : 
* L.A.Sholomov, "Basics of discrete and computational machines" (in Rusian), Moscow, "Nauka", 1980
        

A number 'n' is represented
* in unary  representation : by  n |-s,
* in binary representation : by  0 an 1 digits.

Sample :
  3 is represented as  
    | | | - in unary  representation
    1 1	  - in binary representation
  5 is represented as  
    | | | | | - in unary  representation
    1 0 1     - in binary representation



Input : number 'n' in unary representation
  Sample (n = 5) :
    | | | | |

Output : number 'n' in binary representation
  Sample (n = 5) :
  1 0 1

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?