diff --git "a/khj20006/202503/05 BOJ P5 \353\260\225\354\204\261\354\233\220.md" "b/khj20006/202503/05 BOJ P5 \353\260\225\354\204\261\354\233\220.md" new file mode 100644 index 00000000..a0262dff --- /dev/null +++ "b/khj20006/202503/05 BOJ P5 \353\260\225\354\204\261\354\233\220.md" @@ -0,0 +1,97 @@ +```java + +import java.util.*; +import java.io.*; + +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 long[][] dp; + static int N, K; + static int[] len, A; + static char[][] temp; + static long[] pre; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = Integer.parseInt(br.readLine()); + temp = new char[N][]; + for(int i=0;i 0) { + int diff = Math.min(15, cnt); + tmp = (tmp * pre[diff]) % K; + cnt-=diff; + } + int res = ((int)tmp + A[x]) % K; + dp[res][i|(1<