zoj 2405 Specialized Four-Digit Numbers

 
#include <stdio.h>
int main()
{
	int n, i, sum1, sum2, sum3;
	for(i=2992; i<10000; i++)
	{
		sum1 = sum2 = sum3 = 0;
		n = i;
		while(n)
		{
			sum1 += n % 10;
			n /= 10;
		}
		n = i;
		while(n)
		{
			sum2 += n % 16;
			n /= 16;
		}
		n = i;
		while(n)
		{
			sum3 += n % 12;
			n /= 12;
		}
		if(sum1 == sum2 && sum2 == sum3 )
			printf("%d\\n", i);
	}
    system("pause");
    return 0;
}
/////
//2607370 2011-07-31 08:53:05 Accepted  2405 C 0 156 ylwh! 
#include <stdio.h>
int main()
{
	printf("2992\n2993\n2994\n2995\n2996\n2997\n2998\n2999\n4470\n4471\n4472\n4473\n4474\n44"
"75\n4970\n4971\n4972\n4973\n4974\n4975\n5460\n5461\n5462\n5463\n5464\n5465\n5466"
"\n5467\n5468\n5469\n5960\n5961\n5962\n5963\n6456\n6457\n6458\n6459\n7440\n7441\n"
"7442\n7443\n7444\n7445\n7446\n7447\n7448\n7449\n7940\n7941\n7942\n7943\n8436\n84"
"37\n8438\n8439\n9424\n9425\n9426\n9427\n9428\n9429\n9924\n9925\n9926\n9927\n9928"
"\n9929\n");
	return 0;
}


你可能感兴趣的:(c,System,include,n2,Numbers)