《水题》hdoj acm 1.2.8

#include<stdio.h>
int main() { int i,jin=0,num,sum,sum1,now,j; char ch[4]; int n16[3]={16,256,4096}; int n12[3]={12,144,1728}; for(i=2992;i<10000;i++) {
		num=i;
		sum=0; while(num) {
			sum+=num%10;
			num/=10; }
		num=i;
		sum1=0; for(j=2;j>=0;j--) {
			jin=n16[j];
			now=0; while(num>=jin) {
				now++;
				num=num-jin; }
			sum1+=now; }
		sum1+=num; if(sum1!=sum) continue;
        num=i;
		sum1=0; for(j=2;j>=0;j--) {
			jin=n12[j];
			now=0; while(num>=jin) {
				now++;
				num=num-jin; }
			sum1+=now; }
		sum1+=num; if(sum1!=sum) continue;
		printf("%d\n",i); } }

你可能感兴趣的:(《水题》hdoj acm 1.2.8)