오늘은 참여한지 10일차 입니다.

22일 Basic 챌린지에 대한 상세한 내용은 아래 링크에서 확인할 수 있습니다.

https://developer-p.tistory.com/171

 

[22일 Basic 챌린지 참여] 알고리즘 DAY1

22 Basic Challenge Algorithm https://softsquared.notion.site/Algorithm-5328fab28619430dae2c782d4db6a556 Algorithm 베이직 챌린지 챌린지 대상 : 코딩 테스트 준비해야하는데, 한 번도 해본적은 없어. 일단..

developer-p.tistory.com

 

아래 깃허브 주소에서 백준 Swift 문제풀이를 확인하실 수 있습니다.

https://github.com/SuminPark-developer/BaekJoonPS

 

GitHub - SuminPark-developer/BaekJoonPS: 백준 Swift PS

백준 Swift PS. Contribute to SuminPark-developer/BaekJoonPS development by creating an account on GitHub.

github.com

 


 

Day 10

220302 공부 일지 : 어렵진 않은데 아직 문제 푸는 속도가 느린 것 같다. 더 빠르고 정확해질 수 있도록 노력해야겠다.

 

220302 공부 일지

 


백준 Swift 17388번

// MARK: - 17388번
let input = readLine()!.split(separator: " ").map{Int(String($0))!}
let sum = input.reduce(0, +)

if sum >= 100 {
    print("OK")
}
else {
    let index = input.firstIndex(of: input.min()!)
    switch index {
    case 0:
        print("Soongsil")
    case 1:
        print("Korea")
    case 2:
        print("Hanyang")
    default:
        print("default 없음.")
    }
}

 


백준 Swift 13866번

// MARK: - 13866번
var input = readLine()!.split(separator: " ").map{Int(String($0))!}.sorted(by: <)
let sum1: Int = input[0] + input[3]
let sum2: Int = input[1] + input[2]

print(abs(sum1 - sum2))

 


백준 Swift 5893번(런타임 오류)

// MARK: - 5893번(런타임 오류)
let N = readLine()!
var dec = Int(N, radix: 2)! // 2진수 -> 10진수
dec *= 17

var answer = String(dec, radix: 2) // 10진수 -> 2진수
print(answer)

 


백준 Swift 16431번

// MARK: - 16431번
let bessie = readLine()!.split(separator: " ").map{Int(String($0))!}
var (bessieX, bessieY) = (bessie[0], bessie[1])
let daisy = readLine()!.split(separator: " ").map{Int(String($0))!}
var (daisyX, daisyY) = (daisy[0], daisy[1])
let john = readLine()!.split(separator: " ").map{Int(String($0))!}
var (johnX, johnY) = (john[0], john[1])

var countBessie: Int = max(abs(johnX - bessieX), abs(johnY - bessieY))
var countDaisy: Int = abs(johnX - daisyX) + abs(johnY - daisyY)

if countBessie > countDaisy {
    print("daisy")
}
else if countBessie < countDaisy {
    print("bessie")
}
else {
    print("tie")
}

 


백준 Swift 14470번

// MARK: - 14470번
let A = Int(readLine()!)!
let B = Int(readLine()!)!
let C = Int(readLine()!)!
let D = Int(readLine()!)!
let E = Int(readLine()!)!

var time: Int = 0

if A < 0 { // 고기가 얼어 있다면,
    time += D + (abs(A) * C) + (B * E) // 해동 + 0도까지 올리는 데 걸리는 시간 + 목표 온도(B도)까지 올리는 데 걸리는 시간.
}
else { // 고기가 녹아 있다면,
    time += (B - A) * E // 목표 온도(B도)까지 올리는 데 걸리는 시간.
}

print(time)

 


백준 Swift 19944번

// MARK: - 19944번
let input = readLine()!.split(separator: " ").map{Int(String($0))!}
let (N, M) = (input[0], input[1])

if M == 1 || M == 2 {
    print("NEWBIE!")
}
else if M <= N {
    print("OLDBIE!")
}
else {
    print("TLE!")
}

 


백준 Swift 14935번

// MARK: - 14935번
let x = readLine()!.map{Int(String($0))!}
// NFA일 때는 없으니,
print("FA")

 


백준 Swift 11549번

// MARK: - 11549번
let T = Int(readLine()!)!
let answer = readLine()!.split(separator: " ").map{Int(String($0))!}.filter{$0 == T}.count

print(answer)

 


백준 Swift 16204번

// MARK: - 16204번
let input = readLine()!.split(separator: " ").map{Int(String($0))!}
let (N, M, K) = (input[0], input[1], input[2])

let countO = min(M, K)
let countX = min(N - M, N - K)

print(countO + countX)

 


백준 Swift 14623번

// MARK: - 14623번
let B1 = readLine()!
let B2 = readLine()!
let decB1 = Int(B1, radix: 2)!
let decB2 = Int(B2, radix: 2)!

let temp = decB1 * decB2
let answer = String(temp, radix: 2)
print(answer)

 


DAY10 인증완료

 

DAY10 인증완료

반응형