Counting HexagonsProblem code: CNTHEX |
All submissions for this problem are available.
Dexter wants to make a hexagon by using six sticks for sides from a collection of sticks of lengths 1, 2, 3, ... N. Dexter will only make valid hexagons whose area is strictly positive.
He considers a hexagon "good" if the biggest stick has length at least L and lengths of all the other sticks are not more than X. A "good" hexagon does not have sticks of the same length more than K times. How many ways he can make a "good" hexagon?
For example, when N=8, L=7, X=5, K=3: { 1,2,2,5,5,7 } is a good hexagon but {1,2,2,2,2,7}, { 1,2,3,4,5,6},{1,2,3,4,6,7} are not .
Two hexagons are considered different if their side length sets are different. For example {1,2,3,4,5,6} , {1,1,1,2,2,3} and {1,1,2,2,2,3} are all different hexagons. But {1,2,3,4,5,6} and { 2,4,6,1,3,5} are not different.
Input
Input contains four integers N( 2 <= N <= 10^9) , L ( 2 <= L <= N and N-L<=100) , X( 1<=X< L ) and K ( 1 <= K <= 5) .
Output
Output the number of different ways to make a "good" hexagon % 1000000007.
Sample Input
10 8 6 2
Sample Output
374
| Author: | rustinpiece |
| Date Added: | 6-08-2011 |
| Time Limit: | 6 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, WSPC |
Comments

Fetching successful submissions

are you sure the sample
anybody?? and it has to be a
how to check valid hexagons
amgad, can u explain how u
I'm also getting 378
The sample is correct. You
@angad, i agree with u. d
@angad.. answer is correct.
^ thanks. i see!
my solution is saying time
I just don't really get the
I do not get the logic behind
@vivek:its a prime that's why
can any 1 tell me some other
@admin: here in dis problem,
Can somebody plz tell the
what does positive area mean?