diff --git a/code_study/Baekjoon/python/5565.py b/code_study/Baekjoon/python/5565.py new file mode 100644 index 0000000..f906924 --- /dev/null +++ b/code_study/Baekjoon/python/5565.py @@ -0,0 +1 @@ +print(int(input()) - sum([int(input()) for _ in range(9)])) \ No newline at end of file diff --git a/code_study/Baekjoon/swift/17103.swift b/code_study/Baekjoon/swift/17103.swift new file mode 100644 index 0000000..cebd804 --- /dev/null +++ b/code_study/Baekjoon/swift/17103.swift @@ -0,0 +1,41 @@ +import Foundation + +let MAX_NUM: Int = 1000000 +let SQRT_MAX = Int(sqrt(Double(MAX_NUM))) + +var isPrime: [Bool] = Array(repeating: true, count: MAX_NUM+1) +(isPrime[0], isPrime[1]) = (false, false) + +for n in 2...SQRT_MAX { + if isPrime[n] { + for i in stride(from: n*n, through: MAX_NUM, by: n) { + isPrime[i] = false + } + } +} + +func pairCount(_ num: Int) -> Int { + var ans: Int = 0 + + for n in 2...num/2 { + if isPrime[n] && isPrime[num-n] { + ans += 1 + } + } + + return ans +} + +func solve() -> [String] { + var result: [String] = [] + guard let T = Int(readLine() ?? "") else { return []} + + for _ in 0..