-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboj_19532.java
More file actions
33 lines (27 loc) · 1.09 KB
/
boj_19532.java
File metadata and controls
33 lines (27 loc) · 1.09 KB
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
package brute_force;
import java.io.*;
import java.util.StringTokenizer;
public class boj_19532 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());
int d = Integer.parseInt(st.nextToken());
int e = Integer.parseInt(st.nextToken());
int f = Integer.parseInt(st.nextToken());
for(int i = -999; i <= 999; i++) {
for(int j = -999; j <= 999; j++) {
if(a*i + b*j == c){ // ax + by 가 C이고(x = i, y = j)
if(d*i + e*j == f) { // dx + ey가 f일 때(x = i, y = j)
bw.write(i + " " + j + "\n");
break;
}
}
}
}
bw.flush();
}
}