![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
——数论——
刀锋灬意志
嘤嘤嗡嗡
展开
-
HDU1905-Pseudoprime numbers(快速幂)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1905题目大意:a^p≡a(mod p)成立,前提条件是p是素数,a是整数(本质是费马小定理),现在有一些数p,他不是素数,但是仍然有a^p≡a(mod p)成立,这个p就是伪素数(Pseudoprime)。现在给出p,a的值,求p是不是伪素数。要判断是不是素数,伪素数一定不是素数。然后用...原创 2018-12-12 13:41:41 · 225 阅读 · 1 评论 -
HDU1573-X问题(扩展欧几里得解决同余方程组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1573题目大意:给你上图的余数a和除数m,问你满足上述同余条件且小于等于N的正整数x有几个。扩展欧几里得#define ll long longvoid exgcd(ll a,ll b,ll &d,ll &x,ll &y){ if(b==0) ...原创 2019-03-31 17:54:55 · 250 阅读 · 0 评论 -
HDU5976-Detachment(乘法逆元+贪心)
题目链接Problem DescriptionIn a highly developed alien society, the habitats are almost infinite dimensional space.In the history of this planet,there is an old puzzle.You have a line segment with x...原创 2019-05-11 12:03:06 · 452 阅读 · 3 评论 -
HDU1757-A Simple Math Problem(矩阵快速幂)
题目链接Problem DescriptionLele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);And ai(0<=i<...原创 2019-05-16 21:44:01 · 230 阅读 · 0 评论 -
HDU3944-DP?(Lucas定理+预处理)
题目链接Problem DescriptionFigure 1 shows the Yang Hui Triangle. We number the row from top to bottom 0,1,2,…and the column from left to right 0,1,2,….If using C(n,k) represents the number of row n,...原创 2019-05-31 20:30:01 · 205 阅读 · 1 评论 -
2019南昌邀请赛-Polynomial(拉格朗日插值法)
题目链接定义了 ,数字可能会非常大,所以对9999991取模。对于一个多项式,XH不知道任意一个 ,但是他知道 的值,他想要计算题意f(x)是n次多项式,有n+1个未知数,已知n+1个方程,所以可以f(x)是确定的。求Σf(x), x从L到R。拉格朗日插值法https://www.luogu.org/blog/attack/solution-p4781 分类:一...原创 2019-08-08 20:36:02 · 593 阅读 · 0 评论 -
2019南京网络赛-B-super_log(欧拉降幂)
题目链接题意求幂塔函数,b个a mod m .扩展欧拉定理欧拉定理概念代码参考理解:这两种情况必须要分,但是特例很少,所以很多代码没有考虑到第二种情况(B>=phi(C))但是仍然可以过,应该是数据水,没有特例的情况,也可能不会出现特例??比如 6^1 % 2560 = 6 , 6^ (1+phi(2560)) %2560 => 6^...原创 2019-09-02 22:46:06 · 206 阅读 · 0 评论 -
Exponial (欧拉降幂)
题目链接题意求这个值思路欧拉降幂,刚南京网络赛补了题,找了一个再练练手....#include <bits/stdc++.h>using namespace std;typedef long long ll;ll phi(ll n){ ll k = (ll)sqrt(n+0.5); ll ans = n; for(int...原创 2019-09-02 22:51:48 · 133 阅读 · 0 评论