FLWRS - Flowers
Hanadi has N flower pots each with a unique flower. The pots are arranged along in a line.
One day, She decided to change their order under the condition that no two pots that were
originally next to each other remain next to each other.
write a program that is given the number of pots, calculates the number of possible orders
satisfying the condition modulo a given integer M.
1 ≤ N ≤ 2,000 The number of pots.
2 ≤ M ≤ 1,000,000,000
- Line 1 contains the integer N, the number of flower pots.
- Line 2 contains the integer M.
A single line containing one integer between 0 and M-1 (inclusive): the number of possible
orders modulo M.
For 5 pots, there are 14 orders satisfying Hanadi's condition, assuming the original order
of pots was "ABCDE"
Then the 14 possible orders are:
14 modulo 11 = 3
So the answer is 3.
- Number of test-cases is 28.
SPOJ will run all test cases and give WA after that, even if the first one failed.
giving WA after the last test case. please help. submission id 15034800
please comment on the
which datatype should be used in c?
what is the last case? failing for the last case
What is the last test case?
the range of N is > 1600