본문 바로가기

백준64

[백준] 10870 피보나치수 5 스위프트 2022. 1. 10.
[백준] 10872 팩토리얼 스위프트 2022. 1. 10.
[백준] 1002 터렛 스위프트 let input = Int(readLine()!)! for _ in 1...input { let input1 = readLine()!.split(separator: " ").map{ Double($0)!} let x1 = input1[0] let y1 = input1[1] let r1 = input1[2] let x2 = input1[3] let y2 = input1[4] let r2 = input1[5] //터렛 사이 거리 let r3 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) //터렛이 같은위치에 있고 마린 거리가 다를 때 if r3 == 0 && r1 != r2{ print("0") } // 둘사이 거리가 r1 + r2 보다 클 떄 else i.. 2022. 1. 8.
[백준] 3053 택시 기하학 스위프트 let input = Double(readLine()!)! let round1:Double = 1000000 let a = round(input * input * Double.pi * round1) / round1 let b = input * 2 * input print(a) print(b) 2022. 1. 8.
[백준] 4153 직각삼각형 스위프트 while true { let input = readLine()!.split(separator: " ").map{Int($0)!} let one = input[0] let two = input[1] let three = input[2] if one == 0 && two == 0 && three == 0 { break } var arr:[Int] = [] arr.append(one) arr.append(two) arr.append(three) arr.sort{$0 2022. 1. 7.
[백준] 1085 직사각형에서 탈출 스위프트 let input = readLine()!.split(separator: " ").map{ Int($0)!} //x, y는 사각형 안에 있다 let x = input[0] let y = input[1] let w = input[2] let h = input[3] var wx = w - x var hy = h - y var arr:[Int] = [] arr.append(wx) arr.append(hy) arr.append(x) arr.append(y) print(arr.min()!) 2022. 1. 7.