- 博客(21)
- 资源 (2)
- 收藏
- 关注
原创 SDAU数论练习五-F【贪心】
DiscriptionOn one of the Caribbean Islands there are N tourists and you want to move them from this island to another one.There are only two boats on this island, the first one can hold n1 tourists ...
2020-01-31 16:22:53 337
原创 Codeforces 7C Line【扩展的欧几里得】
DiscriptionA line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to fin...
2020-01-31 15:23:30 289
原创 容斥原理、鸽笼原理
一、容斥定理定义:在计数时,必须注意没有重复,没有遗漏。为了使重叠部分不被重复计算,人们研究出一种新的计数方法。这种方法的基本思想是:先不考虑重叠的情况,把包含于某内容中的所有对象的数目先计算出来,然后再把计数时重复计算的数目排斥出去,使得计算的结果既无遗漏又无重复。这种计数的方法称为容斥原理。举个例子:有A、B两个集合,如图:会发现求AUB时,A+B对AB加了两次,所以再减去一次...
2020-01-30 15:35:21 741
原创 Restoring Number【找规律,有坑】
DiscriptionPavel had two positive integers a and b. He found their sum s and greatest common divisor g, and forgot a and b after that. Help him to restore the original numbers.InputA single line co...
2020-01-29 21:47:41 248
原创 求一个数所有因子个数和因子和
一、求一个数所有因子个数若能整除i,则不断除i,并记录i的次数。则除到最后存在两种情况当x == 1,这说明 x 没有其他因子了,得到答案;当x != 1, 这时 x 为其一个素数因子(且这个因子大于 根号x ),所以结果最后再乘2,得到因子个数。///求一个数所有因子的个数(包括1和它本身)ll countnum(ll x) { ll ans=1; for(ll i...
2020-01-27 23:22:55 1396
原创 POJ -3641Pseudoprime numbers【筛素数+快速幂+欧拉函数降幂】
DisciptionFermat’s theorem states that for any prime number p and for any integer a > 1, a^p = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not...
2020-01-27 19:46:03 201
原创 2020年1月26日训练日记
昨天忘记写博客了,这两天的话,年前那两天打扫了两天卫生,然后各种忙,然后又因为这两天病毒挺严重的,家里也没来人,也没出门就在家里学习了,正合我意。这两天的话,看了一点资料,不多,看了几道题,有一些不太会还没想出来怎么做。包括也有看他们的博客学习,感觉看他们的博客可能理解更快一点,毕竟是同期开始学习的。这两天的话耶的确是没怎么学习,玩了一两天,之后就要开始抓紧了。...
2020-01-27 17:02:18 474
原创 2020年1月22日训练日记
今天白天帮妈妈打扫了一天卫生,感觉其实还蛮开心的,经常不在家,能回来帮妈妈干点活也算是尽了自己的一份心了吧,只不过这几天过年包包子、蒸馒头的确是没帮上什么忙,往常年都是跟妈妈一起做的,今年妈妈看我在学习就没让我干。这两天的话,主要是做了做题,也没怎么干别的,数论三的题实在太难了,我就先放了放,去做了做数论四的内容,换换脑子。数论四的内容主要还是锻炼思维的。今晚做了一道题,卡了我好久。四重循环打表...
2020-01-23 00:57:04 265
原创 SDAU数论练习四-I(我也不知道题号是啥,没搜到)【打表预处理】
DiscriptionI will show you the most popular board game in the Shanghai Ingress Resistance Team.It all started several months ago.We found out the home address of the enlightened agent Icount2three ...
2020-01-22 21:53:46 211
原创 hdu6441 Find Integer
Discriptionpeople in USSS love math very much, and there is a famous math problem .give you two integers n,a,you are required to find 2 integers b,c such that a^n + b^n= c^n.Inputone line contain...
2020-01-21 15:44:12 166
原创 本原勾股数组
本原勾股数组是指一个自然数三元组(a,b,c),其中a,b,c没有公因数,且满足a² +b² =c²。a,b奇偶性不同,且c是奇数若a是奇数,令a=st;则b=(s²-t²)/2;c = (s²+t²)/2。其中s>t>=1是没有公因数的奇数c-b与c+b总是平方数,并且c-b与c+b没有公因数。证明:假设有公因数,设d是c-b与c+b的公因数,则d也整除(c+b)+(...
2020-01-21 15:37:29 1473
原创 2020年1月19日训练日记
这两天的话没怎么做题,主要是在补知识点。数论三的题太难了,看了看实在是不会,就只能先从知识点开始补,数论三里面好多题都是莫比乌斯反演的题,就补了好久的莫比乌斯反演,现在对莫比乌斯反演的话也算是有了个基本的了解。还有一些题是关于莫队算法的,看了几篇博客还是有点懵这两天再多看几篇材料。最近还看了关于杜教筛的一些知识。博客上说杜教筛是以低于线性的时间复杂度来计算积性函数的前缀和的筛法,但是就杜教筛的应用...
2020-01-19 22:42:55 267
转载 杜教筛模板
资源来源杜教筛还看不太懂,先转载大佬博客求杜教筛μ和φ#include<bits/stdc++.h>#include<tr1/unordered_map>#define N 6000010using namespace std;template<typename T>inline void read(T &x){ x=0; ...
2020-01-19 12:08:11 124
原创 莫比乌斯反演入门
一、引入假设有两个函数F(n),f(d),且d∈{x| x|n(即n被d整除)}并有以下关系:F(n)等于所有f(d)之和。即二、推导【μ(d)】由公式得到:F(1)=f(1)F(2)=f(1)+f(2)F(3)=f(1)+ f(3)F(4)=f(1)+f(2)+f(4)F(5)=f(1)+f(5)F(6)=f(1)+f(2)+f(3)+f(6)进而:f(1)=F(1...
2020-01-18 15:57:56 204
原创 2020年1月15日训练日记
这两天可算考完试了。然后就是继续做数论的题。这个专题的题笔上个专题的感觉难了很多。上个专题的题都是一些基础的模板提或者规律题,就算找不到规律打表也能做出来,但是这个专题的很多题都需要想很久,还有一些知识点有些交叉的题,不好想。就比如说做了好几道给定一个公式,让求满足公式的未知量或者未知量的个数,这种就必须要对给定的公式下手,通过化简推到出一个更简单的公式,或者用某种定理可以求的公式。还有就是感觉...
2020-01-15 22:21:37 262
原创 K - GCD Again【欧拉函数】
DiscriptionDo you have spent some time to think and try to solve those unsolved problem after one ACM contest?No? Oh, you must do this when you want to become a “Big Cattle”.Now you will find that ...
2020-01-15 20:56:25 329
原创 C - GCD【化简+欧拉定理】
DiscriptionThe 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 fo...
2020-01-15 20:47:40 353
原创 H - Description has only two Sentences【推导+欧拉定理】
Discriptiona n = X*a n-1 + Y and Y mod (X-1) = 0.Your task is to calculate the smallest positive integer k that a k mod a 0 = 0.InputEach line will contain only three integers X, Y, a 0 ( 1 < X...
2020-01-15 16:08:27 214
原创 G - Calculation【欧拉公式降幂】
DiscriptionAssume that f(0) = 1 and 0^0=1, f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).InputThe first line contains ...
2020-01-15 15:38:04 283
原创 B - HeHe【规律+积性函数+筛法求素数】
DiscriptionIn the equation X^2≡X(mod N) where x∈[0,N-1], we define He[N] as the number of solutions.And furthermore, define HeHe[N]=He[1]*……*He[N]Now here is the problem, write a program, output He...
2020-01-14 10:35:13 227
原创 I - How many integers can you find【容斥定理】
DiscriptionNow you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and...
2020-01-13 19:45:46 104
Java Web图书管理系统源代码
2020-10-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人