
How many sequences
|
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Consider the sequence of K natural numbers: a1, a2, ..., aK. Tooru thinks that this sequence is nice if and only if:
- a1+a2+...+aK = N
- a1 < a2 < ... < aK
- ai+1 - ai <= D for every natural i, smaller than K
- a1 <= D
You are given N, K and D. Please, count the number of nice sequences for her. This number can be huge, so we ask you to output it modulo 109+7.
Input
The first and only line of the input consists of the integers N, K and D, separated by a single space.
Output
Output the number of nice sequences on the first line of the output modulo 109+7.
Example
Input: 10 4 1 Output: 1
Explanation
The only suitable sequence is (1, 2, 3, 4).
Scoring
1 <= N, K, D <= 10 : 17 points.
1 <= N, K, D <= 400 : 23 points.
1 <= N, K, D <= 2000 : 20 points.
1 <= N, K, D <= 105 : 40 points.
Author: | xcwgf666 |
Tester: | |
Editorial | http://discuss.codechef.com/problems/SEQCOUNT |
Tags | dynamic-programming, easy-medium, ltime10, xcwgf666 |
Date Added: | 7-03-2014 |
Time Limit: | 1 sec |
Source Limit: | 50000 Bytes |
Languages: | C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS |
Comments
- Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. |
