SWEA_7728) 다양성 측정
SWEA
# D3
7728) 다양성 측정 (19.10.15)
문제 링크 (SW Expert Academy)
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
|
import java.io.*;
public class Solution {
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 test = Integer.parseInt(br.readLine());
for(int i=1;i<=test;i++) {
boolean[] ch = new boolean[10];
String s = br.readLine();
for(int j=0;j<s.length();j++) {
int a = s.charAt(j)-'0';
ch[a] = true;
}
int cnt = 0;
for(boolean k : ch) if(k) cnt = cnt+1;
bw.write("#" + i + " " + cnt + "\n");
}
bw.flush();
bw.close();
}
}
| cs |
댓글
댓글 쓰기