μκ° μ ν | λ©λͺ¨λ¦¬ μ ν | μ μΆ | μ λ΅ | λ§μ μ¬λ | μ λ΅ λΉμ¨ |
1 μ΄ | 128 MB | 11475 | 8287 | 7581 | 74.127% |
λ¬Έμ
μΈ μ μ΄ μ£Όμ΄μ‘μ λ, μΆμ ννν μ§μ¬κ°νμ λ§λ€κΈ° μν΄μ νμν λ€ λ²μ§Έ μ μ μ°Ύλ νλ‘κ·Έλ¨μ μμ±νμμ€.
μ λ ₯
μΈ μ μ μ’νκ° ν μ€μ νλμ© μ£Όμ΄μ§λ€. μ’νλ 1λ³΄λ€ ν¬κ±°λ κ°κ³ , 1000λ³΄λ€ μκ±°λ κ°μ μ μμ΄λ€.
μΆλ ₯
μ§μ¬κ°νμ λ€ λ²μ§Έ μ μ μ’νλ₯Ό μΆλ ₯νλ€.
μμ μ λ ₯ 1
30 20
10 10
10 20
μμ μΆλ ₯ 1
30 10
μ΄ λ¬Έμ λ λ³λ‘ μ΄λ ΅μ§κ° μλ€. 첫 λ²μ§Έ μ λ ₯μ 보면 30, 10, 10 μ΄ μ λ ₯λκ³ , λ€ λ²μ§Έ μ μ μ’νλ 30μ΄ λλ©΄ λλκ²μ΄λ€.
λ΄κ° μκ°ν΄λΈ λ°©λ²μ λ°°μ΄μ λκ°λ₯Ό λ§λ€μ΄μ ν΄λΉ μΈλ±μ€μ κ°μ μ¦κ° μν¨ ν, λ§μ§λ§μ λ°°μ΄μ κ°μ κ²μ¬ν΄μ κ°μ΄ 2κ° μλ 1μΈ κ°λ§ μΆλ ₯ μν€λ©΄ λλ€.
λμ νμ΄
public class Main {
static int[] xrr = new int[1001];
static int[] yrr = new int[1001];
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
for (int i = 0; i <= 2; i++) {
st = new StringTokenizer(bf.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
xrr[x]++;
yrr[y]++;
}
for (int i = 1; i < xrr.length; i++) {
if (xrr[i] == 1) {
bw.write(i + " ");
break;
}
}
for (int i = 1; i < yrr.length; i++) {
if (yrr[i] == 1) {
bw.write(i +"");
break;
}
}
bw.flush();
bw.close();
}
}
λ€λ₯Έ μ¬λμ νμ΄
λ€λ₯Έ μ¬λμ νμ΄λ₯Ό 보λ€κ° XOR μ°μ°μ μ΄μ©ν΄μ νμ΄ν κ²μ λ΄€λ€. XORμ°μ°μΌλ‘ λΉκ΅ν΄μ λ§μ§λ§ κ²°κ³Όλ₯Ό μΆλ ₯μν€λ κ²μΈλ° λλ°μ΄λ€.
XOR μ°μ°μ ?
X Y XOR
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
int a = 0;
int b = 0;
for (int i = 0; i <= 2; i++) {
st = new StringTokenizer(bf.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
a ^= x;
b ^= y;
}
bw.write(a + " " + b);
bw.flush();
bw.close();
}
}