Algorithm/BOJ

[BOJ] 4153 직각삼각형

yeeendy 2023. 1. 25. 16:39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BOJ2609
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)

            {
                string[] input = Console.ReadLine().Split();

                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);
                int c = int.Parse(input[2]);

                if (a == 0 && b == 0 && c == 0)
                    break;

                if (a * a + b * b == c * c)
                {
                    Console.WriteLine("right");
                    continue;
                }

                if (a * a + c * c == b * b)
                {
                    Console.WriteLine("right");
                    continue;
                }

                if (b * b + c * c == a * a)
                {
                    Console.WriteLine("right");
                    continue;
                }

                Console.WriteLine("wrong");
            }
        }
    }
}

브밤님 블로그 참고

'Algorithm > BOJ' 카테고리의 다른 글

[BOJ] 2751 수 정렬하기 2  (0) 2023.01.25
[BOJ] 10773 제로  (0) 2023.01.25
[BOJ] 2609 최대공약수 최소공배수  (0) 2023.01.25
[BOJ] 10822 더하기  (0) 2023.01.23
[BOJ] 5585 거스름돈  (0) 2023.01.17