import java.util.Scanner; public class _KMP알고리즘_ { static int[] preprocessing(String p) { int m = p.length(); int[] pi = new int[m]; pi[0] = 0; int j = 0; for (int i = 1; i 0 && p.charAt(i) != p.charAt(j)) { j = pi[j - 1]; } if (p.charAt(i) == p.charAt(j)) { pi[i] = j + 1; j += 1; } else { pi[i] = 0; } } return pi; } public static void main(String args[]) { Scanner sc = ne..
import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; class Node2 { int valid; int[] children; int pi; ArrayList indexes; Node2() { valid = -1; children = new int[26]; for (int i = 0; i < 26; i++) { children[i] = -1; } pi = -1; indexes = new ArrayList(); } } public class _Aho_corasick_ { static ArrayList trie = new ArrayList(); static int init() { Node2 x = new Node2()..
import java.util.Scanner; public class _문자열매칭_ { static int match(String s, String p) { int n = s.length(); int m = p.length(); for (int i = 0; i
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class _9465_스티커_DP { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.valueOf(br.readLine()); while (t-- > 0) { int n = Integer.valueOf(br.readLine()); long[][] a = new long[n + 1][2]; { String[] l..
[입력]첫 번째 줄에는 지도의 크기 N(정사각형이므로 가로와 세로의 크기는 같으며 5≤N≤25)이 입력되고, 그 다음 N줄에는 각각 N개의 자료(0혹은 1)가 입력된다.70110100011010111101010000111010000001111100111000 [출력]첫 번째 줄에는 총 단지수를 출력하시오. 그리고 각 단지 내 집의 수를 오름차순으로 정렬하여 한 줄에 하나씩 출력하시오.3789 public class Main_단지번호붙이기 {static int N;static final int[] dr = new int[]{1,-1,0,0};static final int[] dc = new int[]{0,0,-1,1};public static void main(String[] args) throws Exc..
public class CM_순열조합 {public static void main(String[] args) {int[] a = new int[]{1,2,3,4};soon(a, 0, 3, 3);System.out.println();johab(new int[3], 0, 4, 3, 0);} public static void soon(int[] data, int index, int totalDataCnt, int choiceDataCnt){int temp;if(index == choiceDataCnt){int[] dd = new int[choiceDataCnt];for(int i=0; i< dd.length; i++){dd[i] = data[i];}System.out.println(Arrays.toString..
내 블로그 - 관리자 홈 전환 |
Q
Q
|
---|---|
새 글 쓰기 |
W
W
|
글 수정 (권한 있는 경우) |
E
E
|
---|---|
댓글 영역으로 이동 |
C
C
|
이 페이지의 URL 복사 |
S
S
|
---|---|
맨 위로 이동 |
T
T
|
티스토리 홈 이동 |
H
H
|
단축키 안내 |
Shift + /
⇧ + /
|
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.