#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <algorithm>
#define MID(x,y) ( ( x + y ) >> 1 )
#define L(x) ( x << 1 )
#define R(x) ( x << 1 | 1 )
#define BUG puts("here!!!");
#define STOP system("pause");
using namespace std;
int calc(int k, int b) {
int x, sum = 0;
while(k) {
x = k % b;
sum += x;
k = k / b;
}
return sum;
}
int main() {
for(int i = 2992; i <= 9999; i++) {
if(calc(i, 12) == calc(i, 10) && calc(i, 10) == calc(i, 16)) {
printf("%d\n", i);
}
}
return 0;
}
poj 2196 [进制转换 各位求和]
最新推荐文章于 2019-03-08 09:19:09 发布