二进制中1的个数有更优的解法,但是还是显示AC 0%
#include <iostream>
using namespace std;

int DecSum(int i)
{
	int sum = 0;
	while (i)
	{
		sum = sum + i % 10;
		i /= 10;
	}
	return sum;
}

int BinSum(int i)
{
	int count = 0;
	while (i)
	{
		if (i & 1)
			count++;
		i = i >> 1;
	}
	return count;
}

int getRt(int i)
{
	int num = 0;
	for (int index = 1; index <= i; index++)
	{
		if (BinSum(index) == DecSum(index))
		{
			num++;
		}
	}
	return num;
}


int main()
{
	int input = 0;
	while (cin>>input)
	{
		int rt = getRt(input);
		cout << rt << endl;
	}
	return 0;
}