Home B10250. ACM 호텔
Post
Cancel

B10250. ACM 호텔

문제

image

제출 코드

image

  • 풀이는 간단했으나, 출력 부분에서 잘못 이해해서 한번 틀림
  • 호텔 넓이는 입력받아도 쓸 데가 없어서 안씀
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
package bronze;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B10250_ACMhotel {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());

		for(int t=0; t<T; t++) {
			String[] line = br.readLine().split(" ");
			int height = Integer.parseInt(line[0]);
			int n = Integer.parseInt(line[2]);

			if(n%height!=0) {
				System.out.print(n%height);
				System.out.println((n/height+1)<10 ? "0"+(n/height+1) : n/height+1);
			}else {
				System.out.print(height);
				System.out.println((n/height)<10 ? "0"+n/height : n/height);
			}
		}
	}

}
This post is licensed under CC BY 4.0 by the author.