File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+ import java.util.* ;
4+
5+ public class boj9764 {
6+ static BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
7+ static StringTokenizer st;
8+ static void nextLine () throws Exception {st = new StringTokenizer (br .readLine ());}
9+ static int nextInt() {return Integer . parseInt(st. nextToken());}
10+
11+ public static void main(String [] args) throws Exception {
12+ nextLine();
13+ int T = nextInt();
14+ int [] arr = new int [T ];
15+ int max = 0 ;
16+ for (int i = 0 ; i < T ; i++ ) {
17+ nextLine();
18+ arr[i] = nextInt();
19+ max = Math . max(max, arr[i]);
20+ }
21+ int mod = 100999 ;
22+ int [] dp = new int [max + 1 ];
23+ dp[0 ] = 1 ;
24+
25+ for (int k = 1 ; k <= max; k++ ) {
26+ for (int i = max; i >= k; i-- ) {
27+ dp[i] = (dp[i] + dp[i - k]) % mod;
28+ }
29+ }
30+ for (int i = 0 ; i < T ; i++ ) System . out. println(dp[arr[i]]);
31+ }
32+ }
33+ ```
You can’t perform that action at this time.
0 commit comments