随笔分类 -  数论

摘要:FSF’s gameProblem DescriptionFSF has programmed a game.In this game, players need to divide a rectangle into several same squares.The length and width... 阅读全文
posted @ 2014-08-12 20:30 acvc 阅读(320) 评论(0) 推荐(0)
摘要:Given a prime p (p<108),you are to find min{x2+y2},where x and y belongs to positive integer, so that x2+y2=0 (mod p).打表可以看出结论: x=4k+3则没有平方和会等于P 阅读全文
posted @ 2014-05-25 22:15 acvc 阅读(205) 评论(0) 推荐(0)
摘要:Problem XHuge ModInput:standard inputOutput:standard outputTime Limit:1 secondThe operator for exponentiation is different from the addition, subtract... 阅读全文
posted @ 2014-05-01 00:02 acvc 阅读(375) 评论(0) 推荐(0)
摘要:此版本纯属扯淡。。。。。。。一个一个来起。 阅读全文
posted @ 2014-04-26 21:57 acvc 阅读(292) 评论(0) 推荐(0)
摘要:Mashmokh and NumbersIt's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh.In this game Mashmokh writes sequence ofndistinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second int... 阅读全文
posted @ 2014-04-07 11:45 acvc 阅读(323) 评论(0) 推荐(0)
摘要:很高端的理论,一下来自维基百科。在图论中,标号树的普吕弗(Prüfer)序列是由树唯一地产生的序列。n顶点的标号树有长n−2的普吕弗序列,可以从一个简单的迭代算法得到。普吕弗序列在1918年首先由海因茨·普吕弗用来证明凯莱公式。一棵树要得到普吕弗序列,方法是逐次去掉树的顶点,直到剩下两个顶点。考虑树T,其顶点为{1, 2, ...,n}。在第i步,去掉标号最小的叶,并把普吕弗序列的第i项设为这叶的邻顶点的标号。一棵树的序列明显是唯一的,而且长为n−2。这棵标号树有普吕弗序列{4,4,4,5}。把上述算法用在右图标号树。第一步,顶点1是最小标号的叶,因此首先去掉,普吕弗序列首 阅读全文
posted @ 2014-03-27 21:10 acvc 阅读(1874) 评论(0) 推荐(0)
摘要:Let's assume thatv(n)is the largest prime number, that does not exceedn;u(n)is the smallest prime number strictly greater thann.Find.InputThe first line contains integert(1 ≤ t ≤ 500)— the number of testscases.Each of the followingtlines of the input contains integern(2 ≤ n ≤ 109).OutputPrinttli 阅读全文
posted @ 2014-02-27 14:07 acvc 阅读(259) 评论(0) 推荐(0)
摘要:C. On Number of Decompositions into Multiplierstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integermas a product of integersa1, a2, ...an. Your task is to find the number of distinct decompositions of numberminto the product of 阅读全文
posted @ 2014-02-27 14:02 acvc 阅读(256) 评论(0) 推荐(0)
摘要:数论好题题目要求:求给定序列的素因子如果在给定区间内该数字个数加1;思路:打表时求出包含给素数因子的数的个数,详见代码1#include2#include3#include4usingnamespacestd;5constintMAX=10000000+10;6intvis[MAX],sum[MAX],num[MAX];7intmain()8{9inta,l,r,n,m;10scanf("%d",&n);11memset(vis,0,sizeof(vis));12memset(sum,0,sizeof(sum));13for(inti=0;i<n;i++)14 阅读全文
posted @ 2014-01-25 12:11 acvc 阅读(217) 评论(0) 推荐(0)