fork download
  1. #include <iostream>
  2. using namespace std;
  3. bool Cheking(bool arr[]) {
  4. bool q = true;
  5. for (int i = 0; i < 10; i++) if (arr[i] == false) q = false;
  6. if (q == false) return true;
  7. else return false;
  8. }
  9. void Filling(bool arr[], long a) {
  10. int b;
  11. while (a > 0) {
  12. b = a % 10;
  13. arr[b] = (bool)1;
  14. a = (a - b) / 10;
  15. }
  16. }
  17. int main() {
  18. long n, k;
  19. bool arr[10];
  20. while (cin >> n) {
  21. k = 0;
  22. for (int i = 0; i < 10; i++) arr[i] = 0;
  23. while (Cheking(arr)) {
  24. k++;
  25. Filling(arr, k * n);
  26. }
  27. cout << k << '\n';
  28. }
  29. }
Success #stdin #stdout 0.01s 5580KB
stdin
1 9 10
stdout
10
10
9