-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplication.cpp
More file actions
37 lines (30 loc) · 799 Bytes
/
multiplication.cpp
File metadata and controls
37 lines (30 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// NOTE: it is recommended to use this even if you don't understand the following code.
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
// uncomment the following lines if you want to read/write from files
// ifstream cin("input.txt");
// ofstream cout("output.txt");
int N;
cin >> N;
for (int test=0; test<N; test++) {
int K;
cin >> K;
// insert your code here
vector<char> num (0);
long long x = 0;
string temp;
while (num.size() < 10) {
temp = to_string (K * ++x);
for (int i=0; i<temp.size(); i++) {
if (find(num.begin(), num.end(), temp[i]) == num.end()) num.push_back (temp[i]);
}
}
cout << x << endl; // print the result
}
return 0;
}