File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+
3+ import java.util.* ;
4+ import java.io.* ;
5+
6+ class Main {
7+
8+ // IO field
9+ static BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
10+ static BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System . out));
11+ static StringTokenizer st;
12+
13+ static void nextLine () throws Exception {st = new StringTokenizer (br .readLine ());}
14+ static int nextInt() {return Integer . parseInt(st. nextToken());}
15+ static long nextLong() {return Long . parseLong(st. nextToken());}
16+ static void bwEnd() throws Exception {bw. flush();bw. close();}
17+
18+ // Additional field
19+
20+
21+ public static void main(String [] args) throws Exception {
22+
23+ long [][] dp = new long [11 ][2001 ];
24+ for (int i= 1 ;i<= 2000 ;i++ ) dp[1 ][i] = i;
25+ for (int i= 2 ;i<= 10 ;i++ ) {
26+ for (int j= 1 ;j<= 2000 ;j++ ) dp[i][j] = dp[i][j- 1 ] + dp[i- 1 ][j/ 2 ];
27+ }
28+
29+ nextLine();
30+ int T = nextInt();
31+
32+ while (T -- > 0 ) {
33+ nextLine();
34+ int n = nextInt(), m = nextInt();
35+ bw. write(dp[n][m]+ " \n " );
36+ }
37+
38+ bwEnd();
39+ }
40+
41+ }
42+
43+ ```
You can’t perform that action at this time.
0 commit comments