generated from OPCODE-Open-Spring-Fest/template
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0513c1
commit 53a3349
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Bluemin is engaged in a game with red and blue marbles. He has arranged n marbles in a row from left to right. | ||
Surprisingly, the arrangement forms a zebroid. | ||
|
||
A zebroid is a non-empty sequence of red and blue marbles where the colors alternate. | ||
For instance, sequences like (red; blue; red) and (blue) are zebroids, while (red; red) is not. | ||
|
||
Now Bluemin ponders over the number of ways to select a zebroid subsequence from this arrangement. | ||
He seeks your assistance in solving this intriguing puzzle and finding the count modulo 1000000007 (10^9 + 7). | ||
|
||
Input | ||
|
||
The first line presents a single integer n (1 ≤ n ≤ 10^6), indicating the count of marbles in Bluemin's sequence. | ||
|
||
Output | ||
|
||
Your task is to print a single number, the answer to the problem modulo 1000000007 (10^9 + 7). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//write your code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Examples | ||
|
||
Input | ||
3 | ||
Output | ||
6 | ||
|
||
Input | ||
4 | ||
Output | ||
11 | ||
|
||
Note: | ||
Let's consider the first test sample. Let's assume that Bluemin initially had sequence (red; blue; red), so there are six ways to pick a zebroid: | ||
|
||
pick the first marble; | ||
pick the second marble; | ||
pick the third marble; | ||
pick the first and second marbles; | ||
pick the second and third marbles; | ||
pick the first, second and third marbles. | ||
|
||
It can be proven that if Bluemin picks (blue; red; blue) as the initial sequence, the number of ways won't change. |