본문 바로가기
알고리즘/백준

백준 10250 ACM 호텔 자바

by reumiii 2019. 11. 6.
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for (int i = 0; i < t; i++) {
			int h = sc.nextInt();// 층 수
			int w = sc.nextInt();// 방 수
			int n = sc.nextInt();// n번째 손님

			int guestH = n % h; // n번째 손님 층 수
			int guestW = n / h + 1; // n번째 손님 방 수

			if (n % h == 0) {
				guestH = h;
				guestW = n / h;
			}

			System.out.println(guestH + String.format("%02d", guestW));

		}
    }
}

댓글