[SWEA] 희성이의 원근법

문제 보러가기

제한사항

이외의 제한사항은 없다.

Code

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
import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int T= s.nextInt();
		for(int tc=1; tc<=T; tc++) {
			int N = s.nextInt();
			int result = -1;
			if(N<100) {
				result = 0;
			}
			else if(N>=100 && N<1000) {
				result = 1;
			}
			else if(N>=1000 && N<10000) {
				result = 2;
			}
			else if(N>=10000 && N<100000) {
				result = 3;
			}
			else if(N>=100000 && N<1000000) {
				result = 4;
			}
			else if(N>=1000000) {
				result = 5;
			}
			System.out.println("#"+tc+" "+result);
		}
	}
}