import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
static class data{
String type;
int cnt;
data(){cnt=0;}
data(String type,int cnt){this.type = type;this.cnt = cnt;}
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int tc1, tc;
String arr1;
String wear1 = null;
data[] wear = new data[30];
int i, j;
int ilsu1 = 0, ilsu2 = 0;
tc = Integer.parseInt(in.readLine());
while (tc-- > 0) {
int cnt = 0;
tc1 = Integer.parseInt(in.readLine());
for (i = 0; i < tc1; i++) {
arr1 = in.readLine();
st = new StringTokenizer(arr1);
String tmp = st.nextToken();
wear1 = st.nextToken();
for (j = 0; j < cnt; j++) {
if (wear[j].type.compareTo(wear1) == 0) {
wear[j].cnt++;
break;
}
}
if (cnt == j) {
wear[j] = new data(wear1, 1);
cnt++;
}
}
int sum = 1;
for (i = 0; i < cnt; i++) {
sum = sum * (wear[i].cnt+1);
}
bw.write(String.format("%d\n", sum - 1));
bw.flush();
}
}
}
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=3048&sca=2050
'정올문제소스코드' 카테고리의 다른 글
1671 : 색종이(중) (0) | 2021.10.29 |
---|---|
1438 : 색종이(초) (0) | 2021.10.29 |
1516 : 단어 세기 (0) | 2021.10.08 |
1880 : 암호풀기(Message Decoding) (0) | 2021.08.11 |
2857 : 세로읽기 (0) | 2021.08.11 |