D1.cpp 421 B

123456789101112131415161718
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  5. do {
  6. int x = a[0] * 100 + a[1] * 10 + a[2];
  7. int y = a[3] * 100 + a[4] * 10 + a[5];
  8. int z = a[6] * 100 + a[7] * 10 + a[8];
  9. if (y == 2 * x && z == 3 * x) {
  10. cout << x << y << z << endl;
  11. }
  12. } while (next_permutation(a, a + 9));
  13. return 0;
  14. }