[BOJ/C#] 10250 ACM 호텔
Algorithm 2023. 1. 26. 01:22https://www.acmicpc.net/problem/10250
10250번: ACM 호텔
프로그램은 표준 입력에서 입력 데이터를 받는다. 프로그램의 입력은 T 개의 테스트 데이터로 이루어져 있는데 T 는 입력의 맨 첫 줄에 주어진다. 각 테스트 데이터는 한 행으로서 H, W, N, 세 정수
www.acmicpc.net
using System;
using System.IO;
using System.Text;
namespace Assignment01
{
class Program
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader(new BufferedStream(Console.OpenStandardInput()));
StreamWriter sw = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));
int t = int.Parse(sr.ReadLine());
for (int i = 0; i < t; i++)
{
int[] arr = Array.ConvertAll(sr.ReadLine().Split(), int.Parse);
//x = n / h + 1
//y = n % h;
// y가 0일때 꼭대기층
// y -> h
// x 는 -1
//ex) 6번째 손님
// x = 2
// y = 0
// 601호
//12번째 손님
// x = 3
// y = 0
// 602호
//각 테스트 데이터는 한 행으로서 H, W, N
// 호텔의 층 수, 각 층의 방 수, 몇 번째 손님
int h = arr[0];
int w = arr[1];
int n = arr[2];
int x, y;
x = n / h + 1;
y = n % h;
if (y == 0)
{
y = h;
x -= 1;
}
sw.WriteLine("{0}{1:D2}", y, x);
}
sw.Flush();
sr.Close();
sw.Close();
}
}
}
'Algorithm' 카테고리의 다른 글
[BOJ/C#] 11724 연결 요소의 개수 (0) | 2023.01.26 |
---|---|
이분탐색 과 Lower Bound , Upper Bound (상/하한선) (0) | 2023.01.26 |
[BOJ] 10989 수 정렬하기 3 (0) | 2023.01.26 |
[BOJ] 1654 랜선 자르기 (0) | 2023.01.25 |
[BOJ] 1920 수 찾기 (0) | 2023.01.25 |