Description
Input
Output
Sample Input
There is no input for this problem
Sample Output
2992 2993 2994 2995 2996 2997 2998 2999 ...
#include <iostream> #include<cmath> #include<iomanip> using namespace std; int x,y; int sa(int i) { y=0; while(i!=0) { y+=i%10; i=i/10; } return y; } int sb(int i) { y=0; while(i!=0) { y+=i%12; i=i/12; } return y; } int sc(int i) { y=0; while(i!=0) { y+=i%16; i=i/16; } return y; } int main() { int a,b,c,n,i,d; for(i=2992;i<10000;i++) { a=sa(i); b=sb(i); c=sc(i); if(a==b&&b==c) printf("%d\n",i); } return 0; }
G - Specialized Four-Digit Numbers(1.5.2),布布扣,bubuko.com
G - Specialized Four-Digit Numbers(1.5.2)
原文:http://blog.csdn.net/rememberautumn/article/details/37739041