![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 81
摩尔斯
这个作者很懒,什么都没留下…
展开
-
HDU2817 - A sequence of numbers
Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are reco...原创 2019-07-14 16:10:39 · 169 阅读 · 0 评论 -
Iterated Linear Function 矩阵快速幂
Consider a linear function f(x) = Ax + B. Let’s define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g(n)(x) modulo 109 + 7.Input...原创 2019-07-19 12:19:51 · 266 阅读 · 2 评论 -
hihocoder 1882 播放列表 【容斥/DP】
全网就俩博文,,都没啥注释,,懂不起,去牛客群一问,炸出DP是自家学长写的,问到了,第二天补容斥,发现另一篇也是自家学长,好,又问,搞懂了。学长太强了趴;小Hi的手机中存着N首他喜爱的歌曲。现在小Hi希望制作一个长度为L的播放列表,满足每一首歌至少播放一编同一首歌不能连续播放,之间至少间隔一首其他歌曲请你计算一共有多少种不同的播放列表满足条件?由于结果可能非常大,你只需要输出...原创 2019-07-19 10:01:54 · 192 阅读 · 1 评论 -
拓展欧拉 公式及证明
最近做很多题都要用,,每次都要去百度,很气。synapse7大佬的证明过程转载 2019-07-19 09:16:43 · 692 阅读 · 0 评论 -
欧拉函数和求解和两种筛法打表详讲
什么是欧拉函数定义:在数论,对正整数n,欧拉函数是小于n的正整数中与n互质的数的数目(φ(1)=1)。欧拉函数的通式:φ(n)=n*(1-1/p1)(1-1/p2)(1-1/p3)*(1-1/p4)……(1-1/pn),其中p1, p2……pn为n的所有质因数,n是不为0的整数。φ(1)=1(唯一和1互质的数就是1本身)。...原创 2019-07-12 09:53:52 · 372 阅读 · 0 评论 -
HDU 5019 Revenge of GCD
Revenge of GCDTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4124 Accepted Submission(s): 1156Problem DescriptionIn mathematics, the gre...原创 2019-07-18 19:15:07 · 157 阅读 · 0 评论 -
HDU 2068 RPG的错排
Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;…可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的带动,做ACM的女生越来越多,我...原创 2019-07-18 16:12:51 · 127 阅读 · 0 评论 -
拓展欧几里得的三种应用
图源来自于_Warning_大佬板子1:ll exgcd(ll a, ll b, ll &x, ll &y){ if(b==0) { x=1; y=0; return a; } ll g=exgcd(b, a%b, x, y); ll temp=x; x=y; y=te...原创 2019-07-11 15:59:23 · 338 阅读 · 0 评论 -
hdu 2588 GCD最详细讲解
The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6.(a,b) can be easily found by the E...原创 2019-07-15 20:44:49 · 387 阅读 · 0 评论 -
A/B 可以用拓展欧几里得或者欧拉定理做
拓展欧几里得#include<bits/stdc++.h>using namespace std;typedef long long ll;ll exgcd(ll a,ll b,ll &x,ll &y) { if(!b) { x=1; y=0; return a; } ll d=exgcd(b,a%b,x,y); ll t=x; x=y;...原创 2019-07-11 10:55:11 · 174 阅读 · 0 评论 -
素数/质数判定 从判定素数/质数到埃氏筛和欧拉筛
假期集训第二轮是数论,是一直以来不愿意动手的一个分支,忽然发现什么都不会了QAQ。今天先写素数筛。参考洛谷博客 zybnxy大佬 %%%一下1. 判断一个数是素数 时间复杂度为O(N^2)bool Is_prime(int n);{ if(n==1)return false; if(n==2)return true; for( int i=2;i<n;i++...原创 2019-07-11 10:13:11 · 351 阅读 · 0 评论 -
codeforce 785D Anton and School - 2
As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round ...原创 2019-07-17 16:41:25 · 196 阅读 · 0 评论