60652023-10-29 14:55:00GhostSzorzás gyakorláscpp17Accepted 100/1003ms3756 KiB
#include <iostream>
#include <vector>
#include <set>

using namespace std;

void split(int x, set<int>& digits) {
    while (x != 0) {
        digits.insert(x % 10);
        x /= 10;
    }
}

bool check(set<int> digits) {
    for (int j = 0; j < 10; j++) {
        if (digits.count(j) == 0) {
            return 0;
        }
    }
    return 1;
}

int main()
{
    int n, i;
    cin >> n;

    vector<int> start(n);
    for (i = 0; i < n; i++) {
        cin >> start[i];
    }

    set<int> digits;
    int current;
    for (i = 0; i < n; i++) {
        current = start[i];
        split(current, digits);
        int num = 1;
        while (!check(digits)) {
            split(current*(num+1), digits);
            num++;
        }
        cout << num << endl;
        digits.clear();
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2008 KiB
subtask215/15
3Accepted3ms2092 KiB
subtask325/25
4Accepted3ms2328 KiB
5Accepted3ms2428 KiB
6Accepted3ms2656 KiB
7Accepted3ms2832 KiB
8Accepted3ms2748 KiB
9Accepted2ms2852 KiB
10Accepted2ms2960 KiB
11Accepted2ms2964 KiB
subtask420/20
12Accepted3ms3092 KiB
13Accepted3ms3296 KiB
subtask540/40
14Accepted3ms3476 KiB
15Accepted3ms3596 KiB
16Accepted3ms3564 KiB
17Accepted3ms3320 KiB
18Accepted3ms3320 KiB
19Accepted3ms3452 KiB
20Accepted3ms3556 KiB
21Accepted3ms3660 KiB
22Accepted3ms3740 KiB
23Accepted3ms3756 KiB