-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACMHotel.java
35 lines (29 loc) · 961 Bytes
/
ACMHotel.java
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
package mathmatics;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class ACMHotel {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(br.readLine());
for (int i = 0; i < T; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int H = Integer.parseInt(st.nextToken());
int W = Integer.parseInt(st.nextToken());
int N = Integer.parseInt(st.nextToken());
String rs = "";
int floor = ((N - 1) % H) + 1;
int roomNum = (N - 1) / H + 1;
rs += floor;
if(roomNum < 10)
rs += '0';
rs += roomNum;
bw.write(rs + "\n");
}
br.close();
bw.close();
}
}