[Version]
⦁ 2024.04.01 / [Algorithm / Programmers] 정수 제곱근 판별
class Solution {
public long solution(long n) {
if(Math.pow(Math.sqrt(n) + 1, 2) % 1 == 0) {
return (long) Math.pow(Math.sqrt(n) + 1, 2);
}
return -1;
}
}
'Algorithm > 프로그래머스' 카테고리의 다른 글
[Algorithm / Programmers] 하샤드 수 (0) | 2024.04.01 |
---|---|
[Algorithm / Programmers] 정수 내림차순으로 배치하기 (0) | 2024.04.01 |
[Algorithm / Programmers] 없는 숫자 더하기 (0) | 2024.04.01 |
[Algorithm / Programmers] 문자열 내 p와 y의 개수 (0) | 2024.04.01 |
[Algorithm / Programmers] 자연수 뒤집어 배열로 만들기 (0) | 2024.04.01 |