![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 83
chat_c
这个作者很懒,什么都没留下…
展开
-
hdu 5514 Frog(容斥原理)
题目链接:hdu 5514 题目大意:N只青蛙,M个石头构成一个环,第i只青蛙每一次向后跳Ai个石头,即下一步的位置是(当前位置+Ai) mod m,最开始的时候所有青蛙都在位置0,每只青蛙会跳无数次,问最终所有被青蛙跳过的石头的编号之和是多少? 解题思路:第i只青蛙会踩过的石头编号分别为0,gcd(Ai, m), 2 * gcd(Ai, m) ……一共有m/gcd(Ai,m)-1个,这个原创 2016-01-06 23:02:46 · 560 阅读 · 0 评论 -
hdu 5667 Sequence(矩阵快速幂+快速幂+费马小定理)(bestcoder# 80 1002)
Problem Description Holion August will eat every thing he has found. Now there are many foods,but he does not want to eat all of them at once,so he find a sequence. fn=⎧⎩⎨⎪⎪1,ab,a原创 2016-04-25 22:27:50 · 550 阅读 · 0 评论 -
hdu5698 瞬间移动(组合数取摸)(16百度之星round2B)
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description 有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第nn行第m原创 2016-05-22 23:00:27 · 1240 阅读 · 0 评论