알고리즘/백준 BOJ

[BOJ C#] 4153 직각삼각형

왹져박사 2023. 1. 25. 23:18

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();
        }
    }
}