Skip to content

Commit d1fe4a8

Browse files
committed
70차 2번 제출
1 parent 66ef847 commit d1fe4a8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

live6/test70/문제2/이지은.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const input = require('fs')
2+
.readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3+
.toString()
4+
.trim()
5+
.split('\n');
6+
7+
function solution(input) {
8+
let index = 0;
9+
const T = Number(input[index++]);
10+
const results = [];
11+
12+
for (let t = 0; t < T; t++) {
13+
const n = Number(input[index++]);
14+
const clothesMap = {};
15+
16+
for (let i = 0; i < n; i++) {
17+
const [item, type] = input[index++].split(' ');
18+
if (clothesMap[type]) {
19+
clothesMap[type]++;
20+
} else {
21+
clothesMap[type] = 1;
22+
}
23+
}
24+
25+
let result = 1;
26+
for (const type in clothesMap) {
27+
result *= clothesMap[type] + 1;
28+
}
29+
30+
results.push(result - 1);
31+
}
32+
33+
return results.join('\n');
34+
}
35+
36+
console.log(solution(input));

0 commit comments

Comments
 (0)