![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 78
hyesuixin
这个作者很懒,什么都没留下…
展开
-
lightoj 1341__Aladdin and the Flying Carpet
题目描述:It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter原创 2017-07-12 09:08:55 · 244 阅读 · 0 评论 -
POJ - 2773 Happy 2006 (互素的一点性质)
Two positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relatively prime to 2006. Now your job is easy: for the given integer m, find the K-th element which is rela原创 2017-08-22 19:52:31 · 453 阅读 · 0 评论 -
HDU 1222_Wolf and Rabbit (扩展欧几里德定理)
There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get into is the one signed with 0. Then he will get into the hole every m原创 2017-08-15 19:49:14 · 254 阅读 · 0 评论 -
HDU - 1370 Biorhythms(中国剩余定理)
Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is o原创 2017-08-15 20:49:30 · 288 阅读 · 0 评论 -
HDU - 2669 Romantic (扩展欧几里德定理)
The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Trees Trees are Shaking, Leaves are Falling. Lovers Walk passing, and so are You. ................................Write in English class by yifenfei原创 2017-08-15 21:03:11 · 196 阅读 · 0 评论 -
HDU - 6189 Law of Commutation(找规律+推公式 17广西邀请赛题)
As we all know, operation ''+'' complies with the commutative law. That is, if we arbitrarily select two integers aa and bb, a+ba+b always equals to b+ab+a. However, as for exponentiation, such law may be wrong. In this problem, let us consider a modular e原创 2017-09-05 20:46:14 · 1257 阅读 · 0 评论 -
2017 ICPC 乌鲁木齐网赛 E Half-consecutive Numbers
题目描述:(目前没有题目连接,如果到时候有oj挂了这道题会更新连接)题意很简单,给一个N,要你找一个最小的数r,使tr是一个完全平方数,其中tr=(r+1)*(r)/2这个题规律我感觉不是很好找,但我最后也找到了一个比较奇葩的规律解决的这道题,题目要求tr为一个完全平方数,我是先暴力打表找到前面符合条件的r,分别为1,8,49,288,1681,9800。。。然后用这些数算出来的t原创 2017-09-09 18:14:55 · 1364 阅读 · 0 评论 -
CodeForces - 385E Bear in the Field(矩阵快速幂)
题目描述:点击打开链接题意给你六个数n,sx,sy,dx,dy,t。n表示田地的大小,sx,sy是熊的初始位置,dx,dy为熊每秒的速度增加数,t为熊走的时间。接着还有条件是这片田上长着berry初始数量为x+y为每个格子的两坐标值和,并且没过一秒会长一个berry。熊每到一个格子上会吃掉这个格子上的所有berry并且速度上升这个值。然后要求的是t秒之后熊的位置。这题很明显是个递推的。原创 2017-11-06 21:46:21 · 261 阅读 · 0 评论 -
HDU - 5980 Find Small A (ICPC2016 大连现场,一点简单的数学小结论)
题目描述:点击打开链接给你一个数化成二进制,每八位截断单独成为一个数,问这些所有数中一共出现了多少次97。这里就需要考虑一下位运算的问题,首先考虑十进制状态,我们要得到一个数的后两位怎么办,对100取模,要舍弃后两位呢,除以100,这里100其实是10^2。那么这个结论其实转移到二进制状态是同样适用的,我们要得到二进制状态下的后八位,实际上直接对2^8取模就好了,那么这个题实际上就已经原创 2017-10-14 17:50:39 · 302 阅读 · 0 评论 -
HDU - 5974 A Simple Math Problem(ICPC2016 大连现场,简单的数学推理)
题目描述:点击打开链接题意很简单不解释,这题一开始我的考虑是将b质因子分解然后去分配b的质因子讨论最大值,然后看了一眼数据规模就放弃了这个想法,这么多的测试组数明显只能推出某个式子直接进行计算了,那么怎么考虑呢,首先平时做gcd做的比较多,那么先把lcm转换成gcd的话,设z=gcd(x,y),x*y=z*b,x*y/z=b,对于x,y,x=i*z,y=j*z并且i,j肯定是互质的,不然他们的原创 2017-10-14 18:02:39 · 285 阅读 · 0 评论 -
HDU - 5976 Detachment(ICPC2016 大连现场,脑洞加逆元)
题目描述:点击打开链接题意也很简单,不解释。其实这题脑洞做法并不是我想出来的,队友想出来的做法我只负责了代码实现而已,关于做法,这题的分割方案举个例子比如7,7=2+3,后面加不了4了,并且还多出2那么我开始从3开始倒着每个数+1变成7=3+4所以答案就是3*4=12,在比如17=2+3+4+5,这是加不了6,并且还差3那么我们就把这3倒着每个数+1变成17=2+4+5+6,所以答案就是2*4原创 2017-10-14 18:57:53 · 302 阅读 · 0 评论 -
CodeForces 258C Little Elephant and LCM(数学推理)
题目描述:点击打开链接题目给你一个a数列,你要求一个b数列满足以下条件:1,b数列中的数不大于对应位置的a数列中的数。2,b数列的最大值要等于b数列中所有的最小公倍数。求满足条件的b数列的数目。首先考虑如果b数列的最大数等于b中所有数的lcm的话,那么除了这个最大的数,剩下所有的数都是这个最大数的因子。再者这个题你改变a数列的顺序是不改变答案的。所以我们可以先把a排序,找到最大的数max,这就原创 2017-10-16 20:30:21 · 360 阅读 · 0 评论 -
URAL 1013 K-based Numbers. Version 3(矩阵快速幂+大数)
题目描述:点击打开链接题意要求你组成一个N位的K进制数要求没有前导0和相邻的0,求所有能组成的方案总数.在K一定的情况下去考虑N,N=1,2,3时都非常好算,从N等于4开始,由于最高位不能是0,所以最高位只有K-1种选法,先在前K -1位的基础上用(K-1)*f[K-1](f[x]表示x位的方案总数),那么还多出来的方案数就是K-1位上选0的情况,由于不能有相邻的0,那么此时K-2位上就不原创 2017-11-21 21:09:24 · 215 阅读 · 0 评论 -
HDU - 2065 "红色病毒"问题 (指数型母函数+泰勒级数)
医学界发现的新病毒因其蔓延速度和Internet上传播的"红色病毒"不相上下,被称为"红色病毒",经研究发现,该病毒及其变种的DNA的一条单链中,胞嘧啶,腺嘧啶均是成对出现的。 现在有一长度为N的字符串,满足一下条件: (1) 字符串仅由A,B,C,D四个字母组成; (2) A出现偶数次(也可以不出现); (3) C出现偶数次(也可以不出现); 计算满足条件的字符串个数. 当N=2时,所有满足条件的字符串有如下6个:BB,BD,DB,DD,AA,CC. 由于这个数据肯能非常庞大,你只要给出最后原创 2017-08-13 10:05:37 · 342 阅读 · 0 评论 -
HDU - 1557 权利指数 (状态压缩)
在选举问题中,总共有n个小团体,每个小团体拥有一定数量的选票数。如果其中m个小团体的票数和超过总票数的一半,则此组合为“获胜联盟”。n个团体可形成若干个获胜联盟。一个小团体要成为一个“关键加入者”的条件是:在其所在的获胜联盟中,如果缺少了这个小团体的加入,则此联盟不能成为获胜联盟。一个小团体的权利指数是指:一个小团体在所有获胜联盟中成为“关键加入者”的次数。请你计算每个小团体的权利指数。原创 2017-08-13 08:42:44 · 223 阅读 · 1 评论 -
HDU - 1521 排列组合 (指数型母函数)
有n种物品,并且知道每种物品的数量。要求从中选出m件物品的排列数。例如有两种物品A,B,并且数量都是1,从中选2件物品,则排列有"AB","BA"两种。原创 2017-08-13 08:35:34 · 335 阅读 · 0 评论 -
UVA 11395——Sigma Function
题目描述:Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24)原创 2017-07-12 10:24:59 · 452 阅读 · 0 评论 -
LightOJ 1236 - Pairs Forming LCM
Find the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == n ) res++; // lcm means least common multiple return re原创 2017-08-01 09:22:32 · 234 阅读 · 0 评论 -
HDU 4180_ RealPhobia (扩展欧几里德定理)
Bert is a programmer with a real fear of floating point arithmetic. Bert has quite successfully used rational numbers to write his programs but he does not like it when the denominator grows large. Your task is to help Bert by writing a program that decrea原创 2017-08-16 19:20:36 · 452 阅读 · 0 评论 -
HDU - 4596 Yet another end of the world (简单数学推理)
In the year 3013, it has been 1000 years since the previous predicted rapture. However, the Maya will not play a joke any more and the Rapture finally comes in. Fortunately people have already found out habitable planets, and made enough airships to convey原创 2017-08-16 20:00:41 · 248 阅读 · 0 评论 -
HDU - 5446 Unknown Treasure (数论部分定理的综合应用,lucas+CRT)
On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cave because it is there. Somewhere deep in the cave, she found a treasure chest with a combination lock and some num原创 2017-08-16 21:04:25 · 220 阅读 · 0 评论 -
POJ - 1930 Dead Fraction(简单数学推理)
Mike is frantically scrambling to finish his thesis at the last minute. He needs to assemble all his research notes into vaguely coherent form in the next 3 days. Unfortunately, he notices that he had been extremely sloppy in his calculations. Whenever he原创 2017-08-17 09:45:55 · 429 阅读 · 0 评论 -
FZU 1683 纪念SlingShot
已知 F(n)=3 * F(n-1)+2 * F(n-2)+7 * F(n-3),n>=3,其中F(0)=1,F(1)=3,F(2)=5,对于给定的每个n,输出F(0)+ F(1)+ …… + F(n) mod 2009。原创 2017-08-03 09:33:40 · 222 阅读 · 0 评论 -
FZU 1752 A^B mod C (坑坑坑坑!!!)
Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,B,C<2^63).原创 2017-08-03 08:58:45 · 289 阅读 · 0 评论 -
POJ - 2447 RSA (PollarRho大整数的因数分解)
RSA is the best-known public key encryption algorithm. In this algorithm each participant has a private key that is shared with no one else and a public key which is published so everyone knows it. To send a secure message to this participant, you encrypt原创 2017-08-18 17:04:30 · 921 阅读 · 0 评论 -
HDU - 1028 Ignatius and the Princess III (母函数)
"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. "The second problem is, given an positive integer N, we define an equation like this: N=a[1]+a[2]+a[3]+...+a[m]; a[i]>0,1<=m<=N; My quest原创 2017-08-11 17:20:47 · 224 阅读 · 0 评论 -
FZU - 1692 Key problem (矩阵快速幂)
Whenever rxw meets Coral, he requires her to give him the laboratory key. Coral does not want to give him the key, so Coral ask him one question. if rxw can solve the problem, she will give him the key, otherwise do not give him. rxw turns to you for help原创 2017-08-04 17:02:26 · 329 阅读 · 1 评论 -
LightOJ - 1282 Leading and Trailing
You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.原创 2017-07-27 20:26:18 · 207 阅读 · 0 评论 -
SPOJ PROOT Primitive Root (关于原根的一点结论)
题目描述:点击打开链接题意很简单,给一个p,n然后输入n个数,要你依次判断这n个数是否是模p的原根,关于原根的定义和概念自行去查资料就好,关于原根的一个重要性质就是我只需要证明如果存在a^x%p==1(x首先假设存在一个y使a^y%p==1,令g=gcd(q,y),那么必然存在两个数u,v使得vy=g+uq,那么接下来a^(vy)%p=(a^y)^v%p=1,a^(g+uq原创 2017-12-04 20:32:23 · 295 阅读 · 0 评论