#include <cstdio>
int main(){
for (int i = 1; i < 10; ++i){//1 i
for (int j = 1; j < 10; ++j){//2 j
if (j == i) continue;
for (int k = 1; k < 10; ++k){//3 k
if (k == i || k == j) continue;
for (int m = 1; m < 10; ++m){//4 m
if (m == i || m == j || m == k) continue;
for (int n = 1; n < 10; ++n){//5 n
if (n == i || n == j || n == k || n == m) continue;
for (int p = 1; p < 10; ++p){//6 p
if (p == i || p == j || p == k || p == m || p == n) continue;
for (int q = 1; q < 10; ++q){//7 q
if (q == i || q == j || q == k || q == m || q == n || q == p) continue;
for (int r = 1; r < 10; ++r){//8 r
if (r == i || r == j || r == k || r == m || r == n || r == p || r == q) continue;
for (int s = 1; s < 10; ++s){//9 s
if (s == i || s == j || s == k || s == m || s == n || s == p || s == q || s == r) continue;
if ((100 * i + 10 * j + k) * 2 == (100 * m + 10 * n + p)
&& (100 * m + 10 * n + p) * 3 == (100 * q + 10 * r + s) * 2){
printf("%d%d%d:%d%d%d:%d%d%d\n", i, j, k, m, n, p, q, r, s);
}
}
}
}
}
}
}
}
}
}
}
算法竞赛入门经典 习题2-10排列数字1~9形成1:2:3的等比数列
最新推荐文章于 2020-03-02 19:33:21 发布