-->
当前位置:首页 > 题库

PROGRAMMING:Binary classification

Luz5年前 (2021-05-10)题库373
###Task description
```
If we convert a positive integer into a binary number, in this binary number, we call the binary number whose number of digits 1 is more than that of digits 0 as class a number, otherwise it is called class B number.
For example:
(13) 10 = (1101) 2, where the number of 1 is 3, and the number of 0 is 1, then this number is called class a number;
(10) 10 = (1010) 2, where the number of 1 is 2, and the number of 0 is also 2, which is called class B number;
(24) 10 = (11000) 2, where the number of 1 is 2 and the number of 0 is 3, then this number is called class B number;
Program requirements: find out the number of all a and B numbers in K1 ~ K2 (including 1 and 1000 intervals).
```
###Input format:
```
Two integers in a line, separated by spaces, represent K1 and K2 to ensure K1 < K2.
```
###Output format:
```
One line, containing two integers, namely the number of class A and class B, separated by a single space.
```
###Input example:
```in
1 1000
```
###Output example:
```out
538 462
```
###Title Source
Note: this topic is selected from openjudge website http://noi.openjudge.cn/ch0113/36/






answer:If there is no answer, please comment