Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = 10;
- int max_number = 9;
- int max_sum = max_number*n;
- BigInteger d[][] = new BigInteger[15][105];
- for(int i = 0;i<15;i++) for(int j = 0;j<105;j++)
- d[i][j] = BigInteger.ZERO;
- d[0][0] = BigInteger.ONE;
- for(int i = 0; i<n;i++)
- {
- for(int cur_sum = 0; cur_sum < max_sum; cur_sum++)
- {
- for(int j = 0; j<=max_number; j++)
- {
- d[i+1][cur_sum + j] = d[i+1][cur_sum + j].add(d[i][cur_sum]);
- }
- }
- }
- BigInteger x = BigInteger.ZERO;
- for(int k = 0; k<=9*n;k++) {
- x = x.add(d[10][k].multiply(d[10][k]));
- }
- System.out.println(x);
Advertisement
Add Comment
Please, Sign In to add comment