Hypotenuse

시간 제한1초메모리 제한2048 MB

요약
직각삼각형의 두 변과 '?'가 주어질 때 빈 자리에 들어갈 변의 길이를 간단히 한 LaTeX 수식으로 구한다.
난이도

보통10점 중 4점

유형
수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

Martijn is a math teacher and next weeks class is about geometry. He would like to have some tools for his pupils to practice the course material. One of his ideas is to have a program that can solve calculate the unknown length of one side of a right angled triangle, given the other two sides. Pythagorean theorem states that, in a right angled triangle, the square of the hypotenuse is equal to sum of the squares of the other two sides. Your task is to make a solver that uses Pythagorean theorem.

\begin{align*} &\text{AB}^2 + \text{AC}^2 = \text{BC}^2\\ \\ &a^2 + b^2 = c^2 \end{align*}

입력

The input consists out of two integers (0<x,y≤2.3⋅1040 < x, y \leq 2.3 \cdot 10^4) and a question mark ('?'), in any order. The order of the three parts of the input match with aa, bb and cc.

출력

The solution to '?' in its most simple form and in LaTeX notation. For example: 20\sqrt{20} needs to be simplified to 2⋅52 \cdot \sqrt{5}. The formula 2⋅52 \cdot \sqrt{5} is in LaTeX written as "2 \cdot \sqrt{5}".

예제3

  1. 예제 1

    입력
    6 5 ?
    
    예상 출력
    \sqrt{61}
    
  2. 예제 2

    입력
    ? 4 5
    
    예상 출력
    3
    
  3. 예제 3

    입력
    3 9 ?
    
    예상 출력
    3 \cdot \sqrt{10}