-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaraCroft.java
More file actions
40 lines (34 loc) · 1.11 KB
/
LaraCroft.java
File metadata and controls
40 lines (34 loc) · 1.11 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
34
35
36
37
38
39
40
/**
* Created by MalhotR1 on 05/09/2018.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class LaraCroft {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
String[] in = br.readLine().trim().split(" ");
long n = Long.parseLong(in[0]);
long m = Long.parseLong(in[1]);
long k = Long.parseLong(in[2]);
long row = 1;
long col = 1;
if (k < n) {
System.out.println(1 + k + " " + 1);
} else {
k = k - n + 1;
row = n;
if (k < m) {
System.out.println(row + " " + 1 + k);
} else {
k = k - m + 1;
col = m;
row = row - (k + 1) / 2;
k -= (k + 1) / 2;
if ((k & 1) != 0) col--;
System.out.println(row + " " + col);
}
}
}
}
}