- 호텔의 방 배정은 i라인 객실을 전부 채운 후, i+1을 채우는 방식으로 진행 됨.
- 층수는 사람 수(p) % 층(h)로 계산하면 되지만, p == h인 경우에 0이 나오는 오류가 생김.
- 위 경우를 해결하기 위해 p % h == 0 일 경우, h = n으로 바꿔줌.
- 호수는 사람 수(p) / 층(h) 의 올림 값과 같음.
import math
time = int(input())
def hotel(t) :
for i in range(t) :
h, w, p = map(int, input().split())
if h == 1 :
head = str(1)
elif (p % h) == 0 :
head = str(h)
else :
head = str(p % h)
tail = str(math.ceil(p / h))
if len(tail) == 1 :
tail = '0' + tail
print(int(head + tail))
hotel(time)