PS
-
boj)17087 - 숨바꼭질 6PS/boj 2020. 9. 15. 22:39
import java.io.*; import java.util.StringTokenizer; // # 숨바꼭질 6 public class boj_17087 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int s = Integer.parseInt(st.nextToken()); st = new StringTokenizer(br..
-
boj)9613 - GCD 합PS/boj 2020. 9. 15. 22:17
import java.io.*; import java.util.StringTokenizer; // # GCD 합 public class boj_9613 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static int[] arr; public static void main(String[] args) throws IOException { int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) ..
-
boj)1676 - 팩토리얼 0의 개수PS/boj 2020. 9. 15. 21:13
package soup.algorithms.boj; import java.util.Scanner; public class boj_1676 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = 0; for (int i = 5; i 다른 방법 생각 - 0이 뒤에 몇개가 오는가 ? -> 0이 될려면 소수 2 * 5가 되어야하고 결국 2 * 5가 몇 번 등장하는가 ?를 묻는것 - 어떤 수를 소인수분해 했을경우 2보다는 무조건 5가 적을수 밖에 없고 그렇다면 5의 등장 횟수를 찾아야한다. - 1 ~ N의 수를 소인수 분해햇을경우 5의 등장횟수는 5를 나눈 몫과 같다. ..
-
boj)6588 - 골드바흐의 추측PS/boj 2020. 9. 15. 20:27
import java.io.*; import java.util.StringTokenizer; // # 골드바흐의 추측 public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static int a, b, n; static boolean[] prime = new boolean[1000001]; public static void main(String[] args) throws IOException { for (int i = 2; i < p..
-
boj)1929 - 소수 구하기PS/boj 2020. 9. 15. 18:58
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; // # 소수 구하기 public class boj_1929 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws IOException { StringTokenizer st = new StringTokenizer(br.readLine()); int ..
-
boj)17299 - 오등큰수PS/boj 2020. 9. 15. 17:02
import java.io.*; import java.util.Stack; import java.util.StringTokenizer; // #17299_오등큰수 public class boj_17299 { public static void main(String[] args) throws Exception { Stack s = new Stack(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int n = Integer.parseInt(br.readLine()); int[] arr ..
-
boj)17298 - 오큰수PS/boj 2020. 9. 15. 16:10
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; import java.util.StringTokenizer; public class boj_17298 { static Stack s = new Stack(); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws IOException { int ..
-
boj)10799 - 쇠막대기PS/boj 2020. 9. 14. 18:56
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class boj_10799 { static Stack s = new Stack(); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int ans = 0; public static void main(String[] args) throws IOException { char[] chars = br.readLine().toCharArray(); for (int i = 0; i < c..