티스토리 뷰

https://www.acmicpc.net/problem/4153

 

4153번: 직각삼각형

입력은 여러개의 테스트케이스로 주어지며 마지막줄에는 0 0 0이 입력된다. 각 테스트케이스는 모두 30,000보다 작은 양의 정수로 주어지며, 각 입력은 변의 길이를 의미한다.

www.acmicpc.net

 

const input = require('fs')
        .readFileSync('./dev/stdin')
        .toString()
        .trim()
        .split('\n')
        .map((v) =>
                v
                        .split(' ')
                        .map(Number)
                        .sort((a, b) => a - b)
        );

input.pop();
const answer = [];

input.forEach(([a, b, c]) => {
        if (Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)) {
                answer.push('right');
        } else {
                answer.push('wrong');
        }
});

console.log(answer.join('\n'));
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함