Problem K
Mountain Scenes
An artist begins with a roll of ribbon, one inch wide. She clips it into pieces of various integral lengths, then aligns them with the bottom of a frame, rising vertically in columns, to form a mountain scene. A mountain scene must be uneven; if all columns are the same height, it’s a plain scene, not a mountain scene! It is possible that she may not use all of the ribbon.
![\includegraphics[width=0.5\textwidth ]{scenes.jpg}](/problems/scenes/file/statement/en/img-0001.jpg)
If our artist has
![\includegraphics[width=1.0\textwidth ]{goodscenes.jpg}](/problems/scenes/file/statement/en/img-0002.jpg)
She would not form these scenes, because they’re plains, not mountains!
![\includegraphics[width=0.5\textwidth ]{badscenes.jpg}](/problems/scenes/file/statement/en/img-0003.jpg)
Given the length of the ribbon and the width and height of the frame, all in inches, how many different mountain scenes can she create? Two scenes are different if the regions covered by ribbon are different. There’s no point in putting more than one piece of ribbon in any column.
Input
Each input will consist of a single test case. Note that
your program may be run multiple times on different inputs. The
input will consist of a single line with three space-separated
integers
Output
Output a single integer, indicating the total number of
mountain scenes our artist could possibly make, modulo
Sample Input 1 | Sample Output 1 |
---|---|
25 5 5 |
7770 |
Sample Input 2 | Sample Output 2 |
---|---|
15 5 5 |
6050 |
Sample Input 3 | Sample Output 3 |
---|---|
10 10 1 |
1022 |
Sample Input 4 | Sample Output 4 |
---|---|
4 2 2 |
6 |