목록문제/백준_자바 (102)
sm 기술 블로그
import java.util.*; class Main { static int[] tmp; static boolean[] visited; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); sc.close(); tmp = new int[M]; visited = new boolean[N]; DFS(N, M, 0); } private static void DFS(int N, int M, int depth) { if (depth == M) { for (int val : tmp) { System.out.printf(val + " "); } Syst..
import java.util.*; import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sBits = br.readLine().split(" "); int n = Integer.parseInt(sBits[0]); int m = Integer.parseInt(sBits[1]); int five = fiveCnt(n)-fiveCnt(n-m)-fiveCnt(m); int two = twoCnt(n)-twoCnt(n-m)-twoCnt(m); System.o..
import java.util.*; import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int cnt = 0; while (N >= 5) { cnt += N / 5; N = N / 5; } System.out.println(cnt); } } 문제요약 팩토리얼 완료한 값에서 뒤에서부터 0이 아닌 숫자가 나올 때까지 0은 몇번 나오는가? 설명 이 문제는 설명이 그지 같다. 위 처럼 설명만 해도 이..
import java.util.*; import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int T = Integer.parseInt(br.readLine()); while (T != 0) { HashMap clothesType = new HashMap(); int n = Integer.parseInt(br.readLine()); while (n != 0) { String[] sBits = br...