网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
Bob has a not even coin, every time he tosses the coin, the probability that the coin’s front face up is qp(qp≤12)\frac{q}{p}(\frac{q}{p} \le \frac{1}{2})pq(pq≤21).
The question is, when Bob tosses the coin kkk times, what’s the probability that the frequency of the coin facing up is even number.
If the answer is XY\frac{X}{Y}YX, because the answer could be extremely large, you only need to print (X∗Y−1)mod(109+7)(X * Y^{-1}) \mod (10^9+7)(X∗Y−1)mod(109+7).
Input Format
First line an integer TTT, indicates the number of test cases (T≤100T \le 100T≤100).
Then Each line has 333 integer p,q,k(1≤p,q,k≤107)p,q,k(1\le p,q,k \le 10^7)p,q,k(1≤p,q,k≤107) indicates the i-th test case.
Output Format
For each test case, print an integer in a single line indicates the answer.
样例输入
2
2 1 1
3 1 2
样例输出
500000004
555555560
题目来源
这道题自己在做的时候,弄了好大一功夫在弄懂题意。。。。
很多人都以为题目出错了,一个分数模一个值怎么会得到这么大的一个数呢?
其实,换一种想法去看题,我们将X*Y-1MOD1e9+7 ,Y-1看成y的逆元,这道题也就解决了
那么我们就是求二项分布中偶数项概率之和,拿出分母求出其对于mod的逆元再和分子相乘得到结果
那么二项式分布中偶数项概率之和公式为:(1+(1-2p)^n)/2 ,p为概率。
有了这个公式,题目就解决了
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上C C++开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**