[Huawei OD test questions] Numbers without 101 (python version) 100% pass rate super detailed code comment code interpretation

[Huawei OD machine test real questions 2022&2023] real test catalog @click here @
[Huawei OD machine test real questions] signal transmission and reception & trial reading & @click here @
[Huawei OD machine real test questions] rent a car to ride the greenway & trial reading & @点here@

Numbers without 101

Time limit: 1s Space limit: 256MB Limited language: unlimited

Title description:

When Xiao Ming was learning binary, he discovered a type of number that does not contain 101, that is: - Represent numbers in binary, and 101 cannot appear. Now given a positive integer interval [1, r], how many numbers excluding 101 are contained in this interval?

Enter a description:

The only line of input contains two positive integers l, r (1<=l<r<=109&#x

Guess you like

Origin blog.csdn.net/weixin_45541762/article/details/130609569