Dorijanko

Sila(1500)

Aug 24th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. After a successful run from D'Qar, The Resistance has caught The First Order. After Poe Dameron jumped into the X-Wing and blew things up, he thought of an excellent plan. He sent Finn and Rose to find Master Codebreaker to help hack the Dreadnought shield passwords. By hacking, DJ found an array A of N nonnegative integers and 2 numbers, D and K. After some time, Master Codebreaker realized that the password is the number of ways to divide A into K parts such that the sum of elements in each part is less or equal to D. Master Codebreak can solve this task, but can you?
  2.  
  3. As the password can be very large, and the shield defenses isn't good enough, it's enough to output the solution modulo 10^9+7.
  4. Input: N, K, D and A.
  5. Output: Number of ways modulo 10^9+7.
Add Comment
Please, Sign In to add comment