From 279a0bd521eaf3968f506298ffd51d5335ecd5db Mon Sep 17 00:00:00 2001 From: oncsr Date: Wed, 12 Feb 2025 16:46:58 +0900 Subject: [PATCH] =?UTF-8?q?[20250212]=20BOJ=20/=20P3=20/=20=EB=B3=84?= =?UTF-8?q?=EB=8B=A4=EC=A4=84=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3 \353\263\204\353\213\244\354\244\204.md" | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 "khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" diff --git "a/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" "b/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" new file mode 100644 index 00000000..72e26b4e --- /dev/null +++ "b/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" @@ -0,0 +1,99 @@ +```java + +import java.util.*; +import java.io.*; + +class Node{ + Node[] next; + int cnt; + Node(){ + next = new Node[26]; + cnt = 0; + } +} + +class Trie{ + Node root; + Trie(){ + root = new Node(); + } + void insert(String str) { + Node now = root; + for(char i:str.toCharArray()) { + if(now.next[i-'a'] == null) now.next[i-'a'] = new Node(); + now = now.next[i-'a']; + now.cnt++; + } + } +} + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static long nextLong() {return Long.parseLong(st.nextToken());} + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + static Trie trie; + static int N; + static long[][] count; + static long[] dp; + static long mod = (long)1e9 + 7; + static String S; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + } + + static void ready() throws Exception{ + + trie = new Trie(); + N = Integer.parseInt(br.readLine()); + for(int i=0;i