• 문제 링크
https://www.acmicpc.net/problem/19532
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
bw.write(find(read(), read(), read(), read(), read(), read()));
bw.flush();
}
private static String find(int a, int b, int c, int d, int e, int f) {
for (int i = -999; i < 1000; i++)
for (int j = -999; j < 1000; j++) if (a * i + b * j == c && d * i + e * j == f) return i + " " + j;
return "";
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
boolean flag = n == 13;
if (flag) n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return flag ? ~n + 1 : n;
}
}'Problem Solving > Baekjoon' 카테고리의 다른 글
| [백준] 5205 School Colors - Brute Force / Java (0) | 2025.11.12 |
|---|---|
| [백준] 34723 피막치 - Brute Force / Java (0) | 2025.11.11 |
| [백준] 30580 Natatorium - Data Structure / Java (0) | 2025.11.09 |
| [백준] 11346 Cornell Party - Retry - Data Structure / Java (0) | 2025.11.08 |
| [백준] 11345 Cornell Party - Data Structure / Java (0) | 2025.11.07 |
댓글