6065 | 2023-10-29 14:55:00 | Ghost | Szorzás gyakorlás | cpp17 | Accepted 100/100 | 3ms | 3756 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();
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2008 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 3ms | 2092 KiB | ||||
subtask3 | 25/25 | ||||||
4 | Accepted | 3ms | 2328 KiB | ||||
5 | Accepted | 3ms | 2428 KiB | ||||
6 | Accepted | 3ms | 2656 KiB | ||||
7 | Accepted | 3ms | 2832 KiB | ||||
8 | Accepted | 3ms | 2748 KiB | ||||
9 | Accepted | 2ms | 2852 KiB | ||||
10 | Accepted | 2ms | 2960 KiB | ||||
11 | Accepted | 2ms | 2964 KiB | ||||
subtask4 | 20/20 | ||||||
12 | Accepted | 3ms | 3092 KiB | ||||
13 | Accepted | 3ms | 3296 KiB | ||||
subtask5 | 40/40 | ||||||
14 | Accepted | 3ms | 3476 KiB | ||||
15 | Accepted | 3ms | 3596 KiB | ||||
16 | Accepted | 3ms | 3564 KiB | ||||
17 | Accepted | 3ms | 3320 KiB | ||||
18 | Accepted | 3ms | 3320 KiB | ||||
19 | Accepted | 3ms | 3452 KiB | ||||
20 | Accepted | 3ms | 3556 KiB | ||||
21 | Accepted | 3ms | 3660 KiB | ||||
22 | Accepted | 3ms | 3740 KiB | ||||
23 | Accepted | 3ms | 3756 KiB |