Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions HHB/BJ/No_11653.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
44 changes: 44 additions & 0 deletions HHB/BJ/No_9020.java
Original file line number Diff line number Diff line change
@@ -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<T; i++) {
arr[i] = Integer.parseInt(br.readLine());
}

for(int caseNum : arr) {
int a = caseNum/2;
int b = caseNum/2;

while(true) {
if(conf[a-1]==false && conf[b-1]==false) {
System.out.println(a + " " + b);
break;
}
a--;
b++;
}
}

br.close();
}
}