본문 바로가기
코테/백준

[백준] 4153 직각삼각형 스위프트

by 리드맥 2022. 1. 7.

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<$1}

    if arr[0] * arr[0] + arr[1] * arr[1] == arr[2] * arr[2]{
        print("right")
    }else {
        print("wrong")
    }

}

댓글