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 | 31 |
Tags
- custom ui
- custom navigation bar
- button configuration
- 타임라인 포맷팅
- 버튼 피드백
- swift dashed line
- paragraph style
- reactorkit
- swift 점선
- swift navigationcontroller
- task cancellation
- custombottomsheet
- RxSwift
- Tuist
- BFS
- swift concurrency
- swift custom ui
- traits
- task cancel
- identifiable
- swift bottomsheet
- uikit toast
- claen architecture
- DP
- coordinator
- UIKit
- rxdatasources
- swift 백준
- domain data
- SWIFT
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 |