[Programmers_CT] 10. 피타고라스의 정리

문정준's avatar
Feb 05, 2025
[Programmers_CT] 10. 피타고라스의 정리
💡
프로그래머스 코딩 테스트 10. 피타고라스의 정리

1. 문제 설명 - 디버깅

notion image
 

제한 사항

notion image

2. 입출력 예시

notion image
notion image

3. 코드 수정

import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int c = sc.nextInt(); int b_square = c*c - a*a; System.out.println(b_square); } }
  • 빗변의 제곱 - 한 변의 제곱 = 나머지 변의 제곱
    • b_square = c*c - a*a;
 

4. 테스트 실행

notion image

5. 제출 후 채점

notion image
 
Share article

sxias