본문 바로가기

문제풀이

[C언어] 백준 10250 ACM호텔

#include <stdio.h>

int main(void)
{
    int height, width, n, tN; // floor, roomNo, the order of the customer

    scanf("%d", &tN);

    while (tN--)
    {
        scanf("%d %d %d", &height, &width, &n);

        width = n / height;

        if (n % height)
        {
            width++;
            height = n % height;
        }

        printf("%d%02d\n", height, width);
    }

	return 0;
}
#include <stdio.h>

int main(void)
{
    int height, width, n, tN; // floor, roomNo, the order of the customer

    scanf("%d", &tN);

    while (tN--)
    {
        scanf("%d %d %d", &height, &width, &n);
        printf("%d%02d\n", (n - 1) % height + 1, (n - 1) / height + 1);
    }

	return 0;
}