목록전체 글 (245)
말랑한 하루
[ 소스 코드 ] import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Scanner; public class _15664_N과M_10 { static int N, M; static int ary[]; static boolean visit[] = new boolean[9]; static StringBuilder sb = new StringBuilder(); static LinkedHashSet h = new LinkedHashSet(); static void permutation(int index, int cnt, int temp[]) { if (cnt == M) { String..
[ 핵심소스 ] static LinkedHashSet h = new LinkedHashSet(); [ 소스 코드 ] import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Scanner; public class _15663_N과M_9 { static int N, M; static int ary[]; static boolean visit[] = new boolean[9]; static StringBuilder sb = new StringBuilder(); static LinkedHashSet h = new LinkedHashSet(); static void permutation(in..
[ 소스 코드 ] import java.util.Arrays; import java.util.Scanner; public class _15657_N과M_8 { static final int MAX = 8; static int N, M; static int ary[]; static int temp[] = new int[MAX]; static boolean visit[] = new boolean[MAX]; static StringBuilder sb = new StringBuilder(); static void permutation(int index, int cnt) { if (cnt == M ) { String input=""; for(int i=0;i
[ 소스 코드 ] import java.util.Arrays; import java.util.Scanner; public class _15656_N과M_7 { static final int MAX = 7; static int N, M; static int ary[]; static int temp[] = new int[MAX]; static boolean visit[] = new boolean[MAX]; static StringBuilder sb = new StringBuilder(); static void permutation(int cnt) { if (cnt == M ) { String input=""; for(int i=0;i
[ 소스 코드 ] import java.util.Arrays; import java.util.Scanner; public class Solution { static int N; static int M; static int ary[]; static int temp[] = new int[8]; static StringBuilder sb = new StringBuilder(); static void permutation(int index, int cnt) { if (cnt == M) { for (int i = 0; i < M; i++) sb.append(temp[i] + " "); sb.append("\n"); return; } for (int i = index+1; i
[ 소스 코드 ] import java.util.Arrays; import java.util.Scanner; public class Solution { static int N; static int M; static int ary[]; static boolean visit[] = new boolean[9]; static void permutation(int index, int cnt, int temp[]) { if (cnt == M) { for(int item : temp) System.out.print(item+" "); System.out.println(); return; } for(int i=1;i
[ 소스 코드 ] import java.util.Scanner; public class Solution { static int N; static int M; static int index = 0; static int temp[] = new int[8]; static StringBuilder sb = new StringBuilder(); static void permutation(int cnt) { if (cnt == M) { for (int i = 0; i < M; i++) sb.append(temp[i] + " "); sb.append("\n"); return; } for (int i = cnt == 0 ? 1 : temp[cnt - 1]; i
[ 핵심풀이 ] 무수히 많은 출력함수는 시간초과를 가져온다 다음을 사용해서 해결해야한다 Scanner + StringBuilder BufferedReader + StringBuilder [ 소스 코드 ] import java.util.Scanner; public class Solution { static int N; static int M; static int temp[] = new int[7]; static StringBuilder sb = new StringBuilder(); static void permutation(int cnt) { if (cnt == M) { for(int i=0;i