Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class Solve {
  2. // There are N dice with 6 faces.
  3. // We want to know how many patterns are there, which make the total sum becomes target number.
  4. // For example,
  5. // There is 2 dice, target is 7.
  6. //
  7. // 1-6 6-1
  8. // 2-5 5-2
  9. // 3-4 4-3
  10. // 6 cases
  11. public static void main(String[] args) {
  12.  
  13. int d = 2;
  14. int f = 6;
  15. int target = 7;
  16. System.out.println(numRollsToTarget(d, f, target));//6
  17. }
  18.  
  19. static
  20. public int numRollsToTarget(int d, int f, int target) {
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement