티스토리 뷰
https://www.acmicpc.net/problem/9375
9375번: 패션왕 신해빈
문제 해빈이는 패션에 매우 민감해서 한번 입었던 옷들의 조합을 절대 다시 입지 않는다. 예를 들어 오늘 해빈이가 안경, 코트, 상의, 신발을 입었다면, 다음날은 바지를 추가로 입거나 안경대신
www.acmicpc.net
C++ 소스 코드
#include <iostream>
#include <string>
#include <map>
#include <set>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
map<string, int> mp;
set<string> st;
int tc,n,ans;
cin >> tc;
while(tc--){
mp.clear();
st.clear();
ans = 1;
cin >> n;
string name,type;
for(int i=0;i<n;i++){
cin >> name >> type;
mp[type]++;
st.insert(type);
}
set<string>::iterator iter;
for(iter = st.begin(); iter!=st.end(); ++iter){
ans*= mp[*iter]+1;
}
cout << ans-1 << '\n';
}
return 0;
}'Algorithm > 알고리즘 문제풀이' 카테고리의 다른 글
| BOJ) 1966 - 프린터 큐 (0) | 2020.08.02 |
|---|---|
| BOJ) 4949 - 균형잡힌 세상 (0) | 2020.07.28 |
| 프로그래머스) Lv3 - 방문 길이 (0) | 2020.07.25 |
| 프로그래머스) Lv3 - 하노이의 탑 (0) | 2020.07.25 |
| 프로그래머스) Lv3 - 행렬의 곱셈 (0) | 2020.07.19 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- cocoapods
- rxswift
- Swift unowned
- rxswift6
- DispatchQueue
- coreml
- Swift weak
- blendshapes
- 안드로이드
- 알고리즘
- GraphDB
- 카카오인턴십
- infallible
- Reactivex
- 코코아팟
- ARKit
- Swift
- 백준
- ios
- 프로그래머스
- 백준온라인저지
- boj
- disposeBag
- SWEA
- Lottie
- UIHostingController
- Kotlin
- SwiftUI
- C++
- blendshape
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함