Problem Solving/Programmers
[Level 1] 정수 제곱근 판별
kmkunk
2022. 3. 24. 14:23
class Solution {
public long solution(long n) {
return Math.sqrt(n)-(long)(Math.sqrt(n))==0 ? (long)(Math.pow(Math.sqrt(n)+1, 2)) : -1;
}
}