Here is my solution it is giving wrong and can anybody tell me what i am doing wrong???
Question — CSES - Throwing Dice My Solution — sE6Pgm - Online C++0x Compiler & Debugging Tool - Ideone.com
Here is my solution it is giving wrong and can anybody tell me what i am doing wrong???
Question — CSES - Throwing Dice My Solution — sE6Pgm - Online C++0x Compiler & Debugging Tool - Ideone.com
Check the following points once:
Another important thing is that your code doesn’t have that matrix of the initial terms of the recurrence relation, you simply raise a matrix to some power and report the answer, that is wrong I think. For example in the Fibonacci numbers, we have a matrix [1 1], the initial values F1 and F2. Similarly, I think you should precompute the answers for W1, W2, W3, W4, W5, W6, which are the initial terms of the recurrence relation Wi = Wi-1 +Wi-2 + Wi-3 + Wi-4 + Wi-5 + Wi-6.