일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 파이썬
- swift
- on-prem
- LEVEL 2
- 정보과학과
- ESXi 업데이트
- nestedlists
- 방통대 대학원 정보과학과
- 프로그래머스
- secondlowestgrade
- Qualification Round
- ingress-nginx
- 방송통신대학교 대학원 정보과학과
- Kubernetes
- GitLab
- Python
- 하늘과 바람과 별과 詩
- 3D PRINTING
- 해커랭크
- MySQL
- C++
- 2022
- Code Jam 2022
- 코딩테스트
- openebs
- Code Jam
- hackerrank
- 하늘과 바람과 별과 시
- K8S
Archives
- Today
- Total
공대생의 비망록
[프로그래머스][Lv. 1] 폰켓몬 C++ 풀이 본문
https://programmers.co.kr/learn/courses/30/lessons/1845
풀이는 추후에 차차 올리도록 하겠습니다...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#include <vector>
#include <set>
using namespace std;
int solution(vector<int> nums)
{
int allow = nums.size() / 2;
set<int> tmp;
vector<int>::iterator it;
for (it = nums.begin(); it != nums.end(); it++) {
tmp.insert(*it);
}
return (allow > tmp.size() ? tmp.size() : allow);
}
|
cs |
'Programming Language > C, C++' 카테고리의 다른 글
[C++] map 컨테이너에 데이터 추가하기 insert()? [] 연산자? (0) | 2022.05.03 |
---|---|
[프로그래머스][Lv. 2] 124 나라의 숫자 C++ 풀이 (0) | 2022.04.17 |
[Google Code Jam][Qualification Round 2022] 3D Printing C++ 풀이 (0) | 2022.04.03 |
[프로그래머스][Lv. 1] 같은 숫자는 싫어 C++ 풀이 (0) | 2022.03.14 |
[프로그래머스][Lv. 1] 완주하지 못한 선수 C++ 풀이 (0) | 2022.03.14 |
Comments