style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@ -15,11 +15,12 @@ Following is implementation of Dynamic Programming approach. */
// dice where every dice has 'm' faces
class DP {
/* The main function that returns the number of ways to get sum 'x' with 'n' dice and 'm' with m faces. */
/* The main function that returns the number of ways to get sum 'x' with 'n' dice and 'm' with m
* faces. */
public static long findWays(int m, int n, int x) {
/* Create a table to store the results of subproblems.
One extra row and column are used for simplicity
(Number of dice is directly used as row index and sum is directly used as column index).
/* Create a table to store the results of subproblems.
One extra row and column are used for simplicity
(Number of dice is directly used as row index and sum is directly used as column index).
The entries in 0th row and 0th column are never used. */
long[][] table = new long[n + 1][x + 1];
@ -28,7 +29,7 @@ class DP {
table[1][j] = 1;
}
/* Fill rest of the entries in table using recursive relation
/* Fill rest of the entries in table using recursive relation
i: number of dice, j: sum */
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= x; j++) {