BOJ_S1_2527
π [S1_2527] μ§μ¬κ°ν
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static StringTokenizer st;
public static void main (String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (int t = 0; t < 4; t++) {
st = new StringTokenizer(br.readLine());
int x1 = Integer.parseInt(st.nextToken());
int y1 = Integer.parseInt(st.nextToken());
int p1 = Integer.parseInt(st.nextToken());
int q1 = Integer.parseInt(st.nextToken());
int x2 = Integer.parseInt(st.nextToken());
int y2 = Integer.parseInt(st.nextToken());
int p2 = Integer.parseInt(st.nextToken());
int q2 = Integer.parseInt(st.nextToken());
int minX = Math.min(x1, x2); // μ
λ ₯λ°μ xμ’νμ μ΅μκ°
int maxX = Math.max(p1, p2); // μ
λ ₯λ°μ xμ’νμ μ΅λκ°
int minY = Math.min(y1, y2); // μ
λ ₯λ°μ yμ’νμ μ΅μκ°
int maxY = Math.max(q1, q2); // μ
λ ₯λ°μ yμ’νμ μ΅λκ°
int width1 = p1 - x1; // 첫λ²μ§Έ μ§μ¬κ°νμ κ°λ‘ κΈΈμ΄
int height1 = q1 - y1; // 첫λ²μ§Έ μ§μ¬κ°νμ μΈλ‘ κΈΈμ΄
int width2 = p2 - x2; // λλ²μ§Έ μ§μ¬κ°νμ κ°λ‘ κΈΈμ΄
int height2 = q2 - y2; // λλ²μ§Έ μ§μ¬κ°νμ μΈλ‘ κΈΈμ΄
// μ
if (((width1+width2 == maxX-minX) && (height1+height2 > maxY-minY)) || ((height1+height2 == maxY-minY) && (width1+width2 > maxX-minX)))
sb.append("b");
// μ
else if ((width1+width2 == maxX-minX) && (height1+height2 == maxY-minY))
sb.append("c");
// μλ κ²½μ°
else if ((width1+width2 < maxX-minX) || (height1+height2 < maxY-minY))
sb.append("d");
// μ§μ¬κ°ν
else
sb.append("a");
sb.append("\n");
}
System.out.println(sb);
}
}
π€ λμ μκ°
μ λ§.. λμ΄ λΉ μ§ λ» νλ€..γ
μλ μ²μμλ μ’νλ€μ κΈ°μ€μΌλ‘ λ ν¬κ±°λ μκ±°λ λΉκ΅ν΄μ ꡬννμλλ°
100%κΉμ§ κ°μ νλ Έλ€κ³ νλ κ²μ 보면 ν κ°μ§ κ²½μ°μ λ°λ‘κ° μμ κ² κ°μλλ° μ€ν°λμνν
λ€μ΄λ³΄λ κΈ΄ μμκ° λͺ¨μμ΄ λ°λ‘κ° λλ€λ κ²μ΄λ€.
νμΈν΄λ³΄λ κ·Έλ¬λ€.. κ·Έλμ μ’νκ° μλ μ¬κ°νμ κΈΈμ΄λ₯Ό λΉκ΅ν΄μ μ’νλ‘ ν ꡬ쑰λ κ°μ§λ§ κ·Έ λΉκ΅ μμλ₯Ό κΈΈμ΄λ‘ νμ¬ κ΅¬ννμλ€.
μ λ§ νκΈ° μ«μ μ ν μ€ νλλ€ .. νλ€μλ€.