Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solve {
- // There are N dice with 6 faces.
- // We want to know how many patterns are there, which make the total sum becomes target number.
- // For example,
- // There is 2 dice, target is 7.
- //
- // 1-6 6-1
- // 2-5 5-2
- // 3-4 4-3
- // 6 cases
- public static void main(String[] args) {
- int d = 2;
- int f = 6;
- int target = 7;
- System.out.println(numRollsToTarget(d, f, target));//6
- }
- static
- public int numRollsToTarget(int d, int f, int target) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement