땀두 블로그

[백준] 10250번 - ACM 호텔 본문

알고리즘/백준

[백준] 10250번 - ACM 호텔

땀두 2022. 3. 19. 23:06

 

import java.util.Scanner;

public class p10250 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] room = new int[a];
		for (int i = 0; i < a; i++) {
			int w = sc.nextInt();
			int h = sc.nextInt();
			int n = sc.nextInt();
			int ho = n / w;
			if (n % w != 0) {
				ho += 1;
			}
			int floor = n % w;
			if (floor == 0) {
				floor = w;
			}
			room[i] = floor * 100 + ho;
		}
		for (int i = 0; i < a; i++) {
			System.out.println(room[i]);
		}
	}
}
 

나머지가 없는 경우에만 조건문으로 해결하면 어렵지 않게 해결할 수 있다.

 

Comments