We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #205: Dice Game
Project Euler #205: Dice Game
Sort by
recency
|
13 Discussions
|
Please Login in order to post a comment
There is a way to beat all test cases. Initially I used pure combinatorics but this proved to be too slow. One can notice that frequencies of given scores are the coefficients of followinng polynomial P(x) = x + x^2 + ... x^d raised to power n P(x)^n where n is the number of dice. Calculating it directly is way to inefficient, but we can use FFT, specifically its special variant NTT(Number Theoretic Transform). As a n-th root of unity we can use g^k where g in our case is primitive root modulo 1012924417 and k = 483. So we can use direct FFT to get Y vector, then raise every element of the vector to the proper power and then use inverse FFT to get the vector P(x)^n.
Everything is made damn complicated in that formulation of the problem: Why can't the solution just be the fraction as a float with a given precision as in the original euler problem or if they want a reduced fraction ? Why aren't the modulo numbers copy- pastable ?
How 3 * 886308865 = 633077761 please help me
My code cleared the sample test but not the test cases. Can any one tell me how I can get the test cases?
ludo Chat is a fun game and you can invite friends to play with or team vs. team. It's difficult to find different Ludo teams or players with good skills.