BOJ

6679 싱기한 네자리 숫자

공부정리 2017. 10. 3. 03:31

진법변환 문제.


<코드>

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
 
int a[] = { 10,12,16 };
 
int main() {
    for (int i = 1000; i < 10000; i++) {
        int c[3= { 0, };
        for (int j = 0; j < 3; j++for (int temp = i; temp > 0; temp /= a[j]) 
            c[j] += temp%a[j];
        if (c[0== c[1&& c[0== c[2]) printf("%d\n", i);
    }
    return 0;
}
cs