From 56159e8cd01e1058b9275f9eef5460bca87ed914 Mon Sep 17 00:00:00 2001 From: hav-vin Date: Mon, 13 Mar 2023 00:04:00 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[BJ]=2011653=20/=20Java=20/=20=EC=A0=95?= =?UTF-8?q?=EB=8B=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHB/BJ/No_11653.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 HHB/BJ/No_11653.java diff --git a/HHB/BJ/No_11653.java b/HHB/BJ/No_11653.java new file mode 100644 index 0000000..ffc97f4 --- /dev/null +++ b/HHB/BJ/No_11653.java @@ -0,0 +1,24 @@ +package HHB.BJ; + +import java.io.*; + +public class No_11653 { + public static void main(String args[]) throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int N = Integer.parseInt(br.readLine()); + int temp = N; + + if(N>1) { //N=1 이면 아무것도 출력하지 않음 + for(int j=2; j<=temp; j++){ //2~N까지 반복 + + if(temp%j == 0){ //N이 j로 나눠질때 + System.out.println(j); + temp /= j; + j--; + } + } + } + br.close(); + } +} From f7d0e8afbf4cff04e016e9e279321abc4239ca67 Mon Sep 17 00:00:00 2001 From: hav-vin Date: Mon, 13 Mar 2023 00:05:44 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[BJ]=209020=20/=20Java=20/=20=EC=A0=95?= =?UTF-8?q?=EB=8B=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHB/BJ/No_9020.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 HHB/BJ/No_9020.java diff --git a/HHB/BJ/No_9020.java b/HHB/BJ/No_9020.java new file mode 100644 index 0000000..49f252c --- /dev/null +++ b/HHB/BJ/No_9020.java @@ -0,0 +1,44 @@ +package HHB.BJ; + +import java.io.*; + +public class No_9020 { + public static void main(String args[]) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int T = Integer.parseInt(br.readLine()); //케이스의 개수 + int[] arr = new int[T]; + + boolean[] conf = new boolean[10001]; + + conf[0] = true; //1은 소수가 아님 -> 소수아닌건 true로 바꿔줄것 + + for(int i=2; i*i<=conf.length; i++) { + if(!conf[i-1]) { //arr2[1] = 2 부터 시작 + for(int j = i*i; j<=conf.length; j+=i) { //j+=i -> i의 배수 + conf[j-1] = true; //소수아니면 true + } + } + } + + for(int i=0; i