-
프로그래머스 | 정수 제곱근 판별코딩 테스트/프로그래머스 2022. 7. 11. 17:14
// 프로그래머스 정수 제곱근 판별 (12934) public class Solution { public static long solution(long n) { double result = Math.sqrt(n); long answer; if (result % 1 == 0) { answer = (long) Math.pow(result + 1, 2); return answer; } else { answer = -1; } return answer; } }
'코딩 테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 | 없는 숫자 더하기 (0) 2022.07.11 프로그래머스 | 모의고사 (0) 2022.07.11 프로그래머스 | 서울에서 김서방 찾기 (0) 2022.07.11 프로그래머스 | 핸드폰 번호 가리기 (0) 2022.07.11 프로그래머스 | 문자열 내림차순으로 배치하기 (0) 2022.07.11