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
- scene delegate
- task cancellation
- swift 백준
- BFS
- swift navigationcontroller
- custombottomsheet
- RxSwift
- custom navigation bar
- reactorkit
- 타임라인 포맷팅
- traits
- swift bottomsheet
- uikit toast
- swift custom ui
- UIKit
- SWIFT
- button configuration
- claen architecture
- swift dashed line
- domain data
- custom ui
- 버튼 피드백
- rxdatasources
- identifiable
- coordinator
- DP
- swift 점선
- swift concurrency
- Tuist
- task cancel
Archives
- Today
- Total
김경록의 앱 개발 여정
[Swift 백준] 25192 인사성 밝은 곰곰이 본문
풀이 아이디어
중복을 피하는 문제입니다.
Set을 사용했습니다
풀이
let n = Int(readLine()!)!
var set = Set<String>()
var count = 0
for _ in 0..<n {
let input = readLine()!
if input == "ENTER" {
count += set.count
set.removeAll()
} else {
set.insert(input)
}
}
// 마지막 남은 것도 더해줍니다.
count += set.count
print(count)
'Algorithm' 카테고리의 다른 글
[Swift 백준] 11659 구간 합 구하기 4 (0) | 2025.02.11 |
---|---|
[Swift 백준] 3184 양 (0) | 2025.02.07 |
[Swift 백준] 25304 영수증 (0) | 2025.02.06 |
[Swift 백준] 1535 안녕 (0) | 2025.02.05 |
[Swift 백준] 2193 이친수 (0) | 2025.02.01 |