| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- Adapter
- JPA
- springboot
- Layered Architecture
- Transaction
- simplejpaRepository
- Spring
- JDBC
- transactional
- Hexagonal
- Spring Data JPA
- 실무
- hexagonal architecture
Archives
- Today
- Total
Ezcho
[1016] 제곱 ㄴㄴ 수(코드) 본문
import java.util.Scanner;
public class Main {
public static int cnt;
public static boolean[] TF;
public static long min,max;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
min = sc.nextLong();
max = sc.nextLong();
long l = max-min+1;
TF = new boolean[(int)l];
cnt = 0;
for(long i = 2; i <= Math.sqrt(max); i++) {
long pow = i * i;
long start = min % pow == 0 ? min / pow : (min / pow) + 1;
for(long j = start; j * pow <= max; j ++) {
TF[(int) ((j * pow) - min)] = true;
}
}
for(int k=0;k<TF.length;k++)
if(!TF[k])
cnt++;
System.out.print(cnt);
}
}'Algorithm > BOJ' 카테고리의 다른 글
| [1011] Fly me to the Alpha Centauri(코드) (0) | 2022.11.06 |
|---|---|
| [17387] 선분 교차 판별 II(코드) (0) | 2022.10.09 |
| [17386] 선분 교차 판별 1(코드) (0) | 2022.10.02 |
| [13270]피보나치킨(코드+풀이) (1) | 2022.09.14 |
| [1316] 그룹 단어 체커(java) (0) | 2022.08.08 |
Comments