-->
当前位置:首页 > 题库 > 正文内容

PROGRAMMING:Equal length coding

Luz3年前 (2021-05-10)题库385
Equal length coding is a simple and unique coding method. The characteristic of this coding method is that the coding length of each character is the same (the coding length is the number of binary bits contained in each coding). Suppose that the character set contains only four characters a, B, C and D, and the codes represented by two binary are 00, 01, 10 and 11 respectively.
![ QQ screenshot 20210315121621. PNG] (~ / bc9452d1-f92d-4e83-9237-42e15e966352. PNG)
At present, n characters need to be coded, numbered as 1-N, and their binary codes are compared according to the increasing order of dictionary order. For example, when n = 8, the binary codes 0000001011100101101111 are coded as 1,2,3,4,5,6,7,8 respectively.
Given the total number of characters N and the number of one of them m, please give the number of character m when the n characters adopt the equal length coding scheme.
###Input format:
Enter two positive integers n and m (1 < = n, m < 2 ^ 30) in the first line to represent the total number of characters and the specified character number respectively.
###Output format:
Output the equal length code of character M.
###Input example:
```in
20 15
```
###Output example:
```out
01110
```







answer:If there is no answer, please comment

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。