Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 1253번
- UnrealMP
- 오손데이터읽기
- Security
- 백준
- 실습
- 5639
- 1759번
- hackerank
- OS
- objtofbx
- C++
- 셰그먼트트리
- FBX
- 트랜잭션 관리
- SQL
- 2단계로킹
- 백준 1253번
- 1967번
- Unreal
- 의미와 무의미의 경계에서
- 비재귀셰그먼트
- 민겸수
- 데이터베이스 배움터
- UActor
- 언리얼 플러그인
- command not found
- oracle
- 언리얼 커스텀 플러그인
- Linux
Archives
- Today
- Total
fatalite
Sales by Match 본문
if문.. 줄여야하는데
/*
* Complete the 'sockMerchant' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER n
* 2. INTEGER_ARRAY ar
*/
int sockMerchant(int n, vector<int> ar) {
int cnt = 0;
for(int i = 0; i < ar.size(); i++){
if(ar[i] != 0){
for(int k = 0; k < ar.size(); k++){
if(i != k && ar[k] != 0){
if(ar[i] == ar[k]){
cnt++;
cout << ar[i] << " " << ar[k] << endl;
ar[i] = 0;
ar[k] = 0;
}
}
}
}
}
return cnt;
}
'코딩 인터뷰 > C++' 카테고리의 다른 글
거짓말 - 백준 1043 (0) | 2023.02.06 |
---|---|
RGB 거리 - 백준 1149 (0) | 2023.02.05 |
(파이썬 풀이) XOR String 3 (0) | 2023.02.03 |
Subarray Division 2 (0) | 2023.02.03 |
Permuting Two Arrays (0) | 2023.01.26 |