Problem Solving/구현

BOJ10250 ACM 호텔

윤재에요 2024. 1. 31. 14:54

https://www.acmicpc.net/problem/10250

 

10250번: ACM 호텔

프로그램은 표준 입력에서 입력 데이터를 받는다. 프로그램의 입력은 T 개의 테스트 데이터로 이루어져 있는데 T 는 입력의 맨 첫 줄에 주어진다. 각 테스트 데이터는 한 행으로서 H, W, N, 세 정수

www.acmicpc.net

 

 

import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		int T = Integer.valueOf(br.readLine());
		
		for(int i=0; i<T; i++){
		    String[] input = br.readLine().split(" ");
		    int count =1;
		    for(int j=0; j<Integer.valueOf(input[2]);j++){
		        count+=100;
		        if(count/100>Integer.valueOf(input[0])){
		            count-=(Integer.valueOf(input[0])*100);
		            count++;
		        }
		        
		    }
		    bw.write(count+"\n");
		}
		
		
		
		
		
		
		bw.flush();
	}
}
import java.util.Scanner;

class Main
{
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        while (T-- > 0) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            int N = sc.nextInt();

            int floor = ((N - 1) % H) + 1;  // [1, H]
            int number = (N - 1) / H + 1; // [1, W]
            System.out.printf("%d%02d\n", floor, number);
        }
    }
}