#E. 二级202106-5计算好数

    Type: Default 1000ms 256MiB

二级202106-5计算好数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

若将一个正整数化为二进制数,在此二进制数中,我们将数字 1 的个数多于数字 0 的个数的这类二进制数称为好数。例如:(13)10 = (1101)2,其中 1 的个数为 3,0 的个数为 1,则此数是好数;(10)10 = (1010)2,其中 1 的个数为 2,0 的个数也为 2,则此数不是好数;

(24)10 = (11000)2,其中 1 的个数为 2,0 的个数为 3,则此数不是好数;对于给定的 N,写程序求出 1~N 之中(包括 1 与 N)中的好数个数。

输入格式

一个整数,题目中的 N(N ≤ 1000)

输出格式

一个整数,表示 1~N 之中(包括 1 与 N)中的好数个数

输入数据 1

10

输出数据 1

5

二级第5轮了

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
5
Start at
2023-7-30 9:45
End at
2023-8-21 21:45
Duration
540 hour(s)
Host
Partic.
9