Test

문제https://www.acmicpc.net/problem/10952import Foundationvar arr: [Int] = []while true{ let line = readLine()! let lineArr = line.components(separatedBy: " ") let a = Int(lineArr[0])! let b = Int(lineArr[1])! if a==0 && b==0{ for i in 0.. 출처 [Swift] 백준 10952번 문제 A+B - 5https://www.acmicpc.net/problem/10952 10952번: A+B - 5 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicp..


최대공약수// 최대공약수func gcd(_ a: Int, _ b: Int) -> Int{ if b == 0 { return a } else{ return gcd(b, a % b) }} 최소공배수// 최소공배수func lcm(_ a: Int, _ b: Int) -> Int{ return a * b / gcd(a, b)} 제곱수 구하기// pow 함수 두 인자 모두 소수점 형으로 변경해야 오류 발생하지 않음, 두 인자 모두 Double로 변환해서 사용가능func pow(_ x: Decimal, _ y: Int) -> Decimalfunc pow(_: Float, _: Float) -> Float 거듭제곱 구하기(루트)func sqrt(_: Double) -..


// 빈 문자열 생성var emptyString = String()let str = "Hello World!"// isEmpty : String이 빈 문자열인지 확인str.isEmpty // false// split(separator:) : String을 separator를 이용하여 나누고 배열로 출력str.split(separator: " ") // ["Hello", "World!"]// replacingOccurrences(of target: with replacement:)// target 문자열을 replacement로 바꿔서 새로운 String을 출력str.replacingOccurrences(of:" World!", with: "")// trimmingCharacters(in set:)str...