PS 부수기
Project Euler #33 : Digit cancelling fractions 본문
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
int main() {
for (double a = 1; a <= 9; a++) {
for (double b = 1; b <= 9; b++) {
for (double c = 1; c <= 9; c++) {
if (a == c || b == c) continue;
double num1 = a + 10 * c;
double num2 = b * 10 + c;
if (num1 / num2 == a / b) {
debug((int)c*10 + (int)a, (int)b*10 + (int)c);
}
}
}
}
}
|
cs |
답 : 16/64, 19/95, 26/65,49/98
'Project Euler' 카테고리의 다른 글
Project Euler #35 : Circular primes (0) | 2020.08.08 |
---|---|
Project Euler #34 : Digit factorials (0) | 2020.08.08 |
Project Euler #32 : Pandigital products (0) | 2020.08.08 |
Project Euler #31 : Coin sums (0) | 2020.08.08 |
Project Euler #30 : Digit fifth powers (0) | 2020.08.08 |
Comments