git reimport
This commit is contained in:
40
archive/2017.10/2017.10.15 - unsorted/A.java
Normal file
40
archive/2017.10/2017.10.15 - unsorted/A.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class A extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
int[] a = in.nextIntArray(n);
|
||||
int[] b = in.nextIntArray(m);
|
||||
|
||||
for (int i = 1; i < 1000; i++) {
|
||||
String s = Integer.toString(i);
|
||||
|
||||
boolean ok1 = false;
|
||||
for (int j : a) {
|
||||
ok1 |= s.contains(Integer.toString(j));
|
||||
}
|
||||
|
||||
boolean ok2 = false;
|
||||
for (int j : b) {
|
||||
ok2 |= s.contains(Integer.toString(j));
|
||||
}
|
||||
|
||||
if (ok1 && ok2) {
|
||||
out.println(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user