Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 김미경의마흔수업
- K배터리
- css
- html
- database
- 반순혁
- 만일내가인생을다시산다면
- 자바
- 김미경
- JavaScript
- Python
- Java
- 컴퓨터과학
- 서평
- 장편소설
- 오라클
- 개발
- 책
- 데이터베이스
- 김혜남
- 라플라스의마녀
- 코딩
- ComputerScience
- 웹퍼블리싱
- K배터리레볼루션
- 자바스크립트
- 파이썬
- 프로그래밍
- 웹페이지만들기
- 독서
Archives
- Today
- Total
JiYoung Dev 🖥
[JAVA] 제곱근 구하기 (Math) 본문
Math.sqrt()
class Solution {
public long solution(long n) {
long answer = 0;
double x = Math.sqrt(n);
if(x * 10 % 10 == 0) {
answer = (long)((x+1) * (x+1));
}else {
answer = -1;
}
return answer;
}
}
'Question' 카테고리의 다른 글
[Thymeleaf] th:onclick과 location.href 함께 사용하기 (0) | 2023.08.08 |
---|---|
[JAVA] String에서 int로 변환 (0) | 2023.08.08 |
[JAVA] long 타입에서 String 타입으로 변환하기 (0) | 2023.08.07 |
[Java] 문자열에서 배열로 변환하는 방법 (0) | 2023.07.28 |
[JAVA] 스트림(Stream) (0) | 2023.07.27 |