//1_5_2: Specialized Four_Digit Numbers 10,12和16进制的数字和相等 POJ2196 ZOJ2405
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int i,j,sum1,sum2,sum3;
for(i = 2992;i < 10000;i ++)
{
sum1 = sum2 = sum3 = 0;
j = i;
while(j != 0)
{
sum1 += j % 10;
j = j / 10;
}
j = i;
while(j != 0)
{
sum2 += j % 12;
j = j / 12;
}
j = i;
while(j != 0)
{
sum3 += j % 16;
j = j / 16;
}
if(sum1 == sum2 && sum2 == sum3) printf("%d\n",i);
}
return 0;
}
/*测试结果:通过POJ2196 ZOJ2405检测
2992
2993
2994
2995
2996
2997
2998
2999
4470
4471
4472
4473
4474
4475
4970
4971
4972
4973
4974
4975
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5960
5961
5962
5963
6456
6457
6458
6459
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7940
7941
7942
7943
8436
8437
8438
8439
9424
9425
9426
9427
9428
9429
9924
9925
9926
9927
9928
9929
请按任意键继续. . .
*/