提交了,成功了:

#include <iostream>
using namespace std;

int thirdBinaryDigitFromLast(int n)
{
	int times = 0;

	if(n <= 3)
		return 0;

	while(n)
	{
		times++;
		if(3 == times)
		{
			if(0 == n % 2)
				return 0;

			return 1;
		}
			
		n /= 2;
	}
}

int main()
{
	char str[4];
	int n;

	while(cin >> str)
	{
		n = atoi(str);
		cout << thirdBinaryDigitFromLast(n) << endl;	
	}

	return 0;
}




本文转载:CSDN博客