sicily 1014

 
#include "iostream"
using namespace std;
int main()
{
	int n = 2992;
	do
	{
		int sum1 = 0, sum2 = 0, sum3 = 0;
		sum1 = n % 10 + n / 10 % 10 + n / 100 % 10 + n / 1000;//十进制数的相加和
		int m = n;
		while (m > 0)
		{
			sum2 += m % 12;//十二进制数的相加和
			m /= 12;
		}
		int q = n;
		while (q > 0)
		{
			sum3 += q % 16;//十六进制数的相加和
			q /= 16;
		}
		if (sum1 == sum2 && sum2 == sum3)
			cout << n << endl;
		n = n + 1;
	}while (n > 2990 && n <= 9999);
}

你可能感兴趣的:(include)