
数论
文章平均质量分 73
PhyCode
Just Dreaming~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
大素数测试和大数素因子分解
小黄书第19章p82页根据合数的拉宾-米勒测试可得到素数的必要条件。 参考资料。 以POJ1811 Prime Test 为例。 #include #include #include #include using namespace std; typedef long long LL; const int S=20; LL pfact[10005],ant; LL multi_mod(L原创 2016-07-15 20:00:25 · 1220 阅读 · 0 评论 -
2016ACM-ICPC沈阳网络预选赛1004 Mathematician QSC
题意:给出n,y,x,s,已知f(n)=2∗f(n−1)+f(n−2)f(n)=2*f(n-1)+f(n-2),g(n)=∑ni=0f(i)2g(n)=\sum_{i=0}^nf(i)^2,求xg(n∗y)%(s+1)x^{g(n*y)}\%(s+1). 思路:看到递推公式,第一反应是可以用矩阵优化来求解f(n)f(n),因为递推的关系,求出前几个g(n)g(n)上OEIS搜了一波,发现g(n)=原创 2016-09-18 23:30:38 · 391 阅读 · 0 评论 -
Intel Code Challenge Final Round C.Ray Tracing
C.Ray Tracing题意:在n*m的空间内,一个小球从(0,0)以固定的速度2√\sqrt2,并且以斜45°的角度出发.若碰到空间边界则反弹.若碰到空间四个角落的点则停止.给你k个点,问到达该点所需时间,若到达不了,则输出-1.思路: 1. 按照给出的样例模拟走几遍,可以发现结束的时间为lcm(n,m)lcm(n,m). 2. 希望将这些折线放在y=xy=x这条直线上,就可以方便计算某点原创 2016-10-12 23:40:31 · 368 阅读 · 0 评论 -
Codeforces 615D Multipliers(数学推公式)
Codeforces 615D Multipliers(数学推公式)原创 2016-04-05 08:46:20 · 845 阅读 · 0 评论