Skip to content

Commit

Permalink
BOJ-EX: 5/19/2024, 3:52:46 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
fkdl0048 committed May 19, 2024
1 parent 0479fc6 commit ccc480a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
41 changes: 41 additions & 0 deletions 9375번: νŒ¨μ…˜μ™• μ‹ ν•΄λΉˆ/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 9375번: νŒ¨μ…˜μ™• μ‹ ν•΄λΉˆ - <img src="https://static.solved.ac/tier_small/8.svg" style="height:20px" /> Silver III

<!-- performance -->

<!-- 문제 제좜 ν›„ κΉƒν—ˆλΈŒμ— ν‘Έμ‹œλ₯Ό ν–ˆμ„ λ•Œ μ œμΆœν•œ μ½”λ“œμ˜ μ„±λŠ₯이 μž…λ ₯될 κ³΅κ°„μž…λ‹ˆλ‹€.-->

<!-- end -->

## 문제

[문제 링크](https://boj.kr/9375)


<p>ν•΄λΉˆμ΄λŠ” νŒ¨μ…˜μ— 맀우 λ―Όκ°ν•΄μ„œ ν•œλ²ˆ μž…μ—ˆλ˜ μ˜·λ“€μ˜ 쑰합을 μ ˆλŒ€ λ‹€μ‹œ μž…μ§€ μ•ŠλŠ”λ‹€. 예λ₯Ό λ“€μ–΄ 였늘 ν•΄λΉˆμ΄κ°€ μ•ˆκ²½, μ½”νŠΈ, μƒμ˜, μ‹ λ°œμ„ μž…μ—ˆλ‹€λ©΄, λ‹€μŒλ‚ μ€ 바지λ₯Ό μΆ”κ°€λ‘œ μž…κ±°λ‚˜ μ•ˆκ²½λŒ€μ‹  렌즈λ₯Ό μ°©μš©ν•˜κ±°λ‚˜ ν•΄μ•Όν•œλ‹€. ν•΄λΉˆμ΄κ°€ 가진 μ˜μƒλ“€μ΄ μ£Όμ–΄μ‘Œμ„λ•Œ κ³Όμ—° ν•΄λΉˆμ΄λŠ” μ•ŒλͺΈμ΄ μ•„λ‹Œ μƒνƒœλ‘œ λ©°μΉ λ™μ•ˆ 밖에 λŒμ•„λ‹€λ‹ 수 μžˆμ„κΉŒ?</p>



## μž…λ ₯


<p>첫째 쀄에 ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€κ°€ 주어진닀. ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€λŠ” μ΅œλŒ€ 100이닀.</p>

<ul>
<li>각 ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€μ˜ 첫째 μ€„μ—λŠ” ν•΄λΉˆμ΄κ°€ 가진 μ˜μƒμ˜ 수 n(0 ≀ n ≀ 30)이&nbsp;주어진닀.</li>
<li>λ‹€μŒ nκ°œμ—λŠ” ν•΄λΉˆμ΄κ°€ 가진&nbsp;μ˜μƒμ˜ 이름과 μ˜μƒμ˜ μ’…λ₯˜κ°€ 곡백으둜 κ΅¬λΆ„λ˜μ–΄ 주어진닀. 같은 μ’…λ₯˜μ˜ μ˜μƒμ€ ν•˜λ‚˜λ§Œ μž…μ„ 수 μžˆλ‹€.</li>
</ul>

<p>λͺ¨λ“  λ¬Έμžμ—΄μ€ 1이상 20μ΄ν•˜μ˜ μ•ŒνŒŒλ²³ μ†Œλ¬Έμžλ‘œ μ΄λ£¨μ–΄μ ΈμžˆμœΌλ©° 같은 이름을 가진 μ˜μƒμ€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ”λ‹€.</p>



## 좜λ ₯


<p>각 ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€μ— λŒ€ν•΄ ν•΄λΉˆμ΄κ°€ μ•ŒλͺΈμ΄ μ•„λ‹Œ μƒνƒœλ‘œ μ˜μƒμ„ μž…μ„ 수 μžˆλŠ” 경우λ₯Ό 좜λ ₯ν•˜μ‹œμ˜€.</p>



## μ†ŒμŠ€μ½”λ“œ

[μ†ŒμŠ€μ½”λ“œ 보기](νŒ¨μ…˜μ™•%20μ‹ ν•΄λΉˆ.cpp)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: ::: ::: */
/* Problem Number: 9375 :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fkdl4878 <boj.kr/u/fkdl4878> +#+ +#+ +#+ */
/* +#+ +#+ +#+ */
/* https://boj.kr/9375 #+# #+# #+# */
/* Solved: 2024/05/19 15:33:17 by fkdl4878 ### ### ##.kr */
/* */
/* ************************************************************************** */

#include <bits/stdc++.h>
using namespace std;

int main(){
int tcase;
string a, b;
int ret;

cin >> tcase;
while (tcase--)
{
map<string, int> m;
int n;
cin >> n;
for (int i = 0; i < n; i++){
cin >> a >> b;
m[b]++;
}

ret = 1;
for(auto it : m){
ret *= it.second + 1;
}

cout << ret - 1 << '\n';
}
}
Binary file not shown.

0 comments on commit ccc480a

Please sign in to comment.