엘베가 젤 왼쪽

손님들은 1호부터 배정받아야하고

층수가 낮은것부터 채워나간다


테스트 케이스 와 h w n->방번호 를입력 하면 몇호인지 출력


2
6 12 10
30 50 72



402
1203


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
 
 
public class Main {
    
    
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine().trim();
        int countTry = Integer.valueOf(input);
        String disInput = "";
        int h=0;
        int w=0;
        int num=0;
        int count=1;
        String output="";
        for(int i=0  ; i <countTry ; i++) {
            
            disInput = sc.nextLine().trim();
            int a = disInput.indexOf(" ");
            int b = disInput.lastIndexOf(" ");
            h = Integer.parseInt(disInput.substring(0, a));
            w = Integer.parseInt(disInput.substring(a+1, b));
            num = Integer.parseInt(disInput.substring(b+1, disInput.length()));
                
            while(num>h) {
                num=num-h;
                count++;
            }
            
            output = num+"";
            
            if(count < 10) {
                output +="0"+count;
            }else {
                output +=count;
            }
            
            System.out.println(output.trim());
            count=1;
        }
    }
    
}
 


'오락기 > codeWar' 카테고리의 다른 글

백준 2755 부녀회장이 될테야  (0) 2018.05.25
백준 1924 2007년  (0) 2018.05.25
백준 8721267 벌집  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25

+ Recent posts