본문 바로가기
알고리즘/백준 BOJ

[BOJ C#] 4153 직각삼각형

by 왹져박사 2023. 1. 25.
728x90

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace _4153
{
    class Program
    {
        static void Main()
        {
            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
            StringBuilder sb = new StringBuilder();

            List<string> arr = new List<string>();
            
            while(true)
            {
                string[] arrString = sr.ReadLine().Split(' ');
                int a = int.Parse(arrString[0]);
                int b = int.Parse(arrString[1]);
                int c = int.Parse(arrString[2]);
                if (a == 0 || b == 0 || c == 0)
                    break;

                if (Math.Pow(a, 2) + Math.Pow(b, 2) == Math.Pow(c, 2) || Math.Pow(a, 2) + Math.Pow(c, 2) == Math.Pow(b, 2) || Math.Pow(b, 2) + Math.Pow(c, 2) == Math.Pow(a, 2))
                    sb.Append("right\n");
                else
                    sb.Append("wrong\n");
            }
            sw.WriteLine(sb);

            sr.Close();
            sw.Flush();
            sw.Close();
        }
    }
}

728x90

'알고리즘 > 백준 BOJ' 카테고리의 다른 글

[BOJ C#] 1259 팰린드롬수  (0) 2023.01.26
[BOJ C#] 1085 직사각형에서 탈출  (0) 2023.01.25
[BOJ C#] 10250 ACM 호텔  (0) 2023.01.25
[BOJ C#] 2798 블랙잭  (0) 2023.01.25
[BOJ C#] 2775 부녀회장이 될테야  (0) 2023.01.25