HDU 2057 A + B Again(16进制加法)
944
2022-08-23
Problem 100 Arranged probability (丢番图方程)
Arranged probability
Problem 100
If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)×(14/20) = 1/2.
The next such arrangement, for which there is exactly 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
By finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain.
题解:b*(b-1) / (n*(n-1)) = 1/2
==> n^2-2b^2-n+2b = 0
==> (2n-1)^2-2(2p-1^2)= -1
==>上面的是第二型佩尔方程
==>关于第二型佩尔方程的正整数解的通用解法,好像还是一个未解决问题。
==>考虑到(1,1)为这个方程的最小解,记为(x1,y1)则第二型佩尔方程有通解公式: ==>xn=(1/2)((x1+y1sqrt(d))^(2n+1)+(x1-y1sqrt(d))^(2n+1)) ==>yn=(1/(2sqrt(d)))((x1+y1sqrt(d))^(2n+1)-(x1-y1sqrt(d))^(2n+1))
==>其中,d=2. 于是,构成线性地推: x_(n+1) = 3x_n+4y_n y_(n+1) = 2x_n+3y_n
==> n0=0,b0=0 and n0=1,b0=1 n(n+1) = P*n(n)+Q*b(n)+K b(n+1) = R*n(n)+S*b(n)+L P=3, Q=2, K=-2, R=4, S=3, L=-3
代码:
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~