
数论
文章平均质量分 87
咕咕评测姬
大白大大白
展开
-
HDU —— 1239 Calling Extraterrestrial Intelligence Again(找素数水题)
Problem Description A message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of Saturday November 16, 1974. The messa...原创 2018-09-10 23:52:42 · 195 阅读 · 0 评论 -
RSA——HDU1211(扩展欧几里得
Problem Description RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow: > choose two large prime integer p, q > calculate n = p × q, ...原创 2018-09-10 23:09:46 · 443 阅读 · 0 评论 -
欧拉函数(phi)
欧拉函数:phi[n]小于等于n的与n互质的数的个数 PHI(n) = (p1 ^ k1 - p1 ^ (k1 - 1)) * (p2 ^ k2 - p2 ^ (k2 - 1)) * ... * (pn ^ kn - pn ^ (kn - 1)) =n*(p1-1)(p2-1)……(pi-1)/(p1*p2*……pi); =...原创 2018-09-03 22:55:02 · 3480 阅读 · 0 评论 -
Eratosthenes筛法——欧拉筛
Eratosthenes筛法memset(vis,0,sizeof(vis)); for(int i = 2; i <= n; i++) for(int j = 2 * i; j <= n; j += i) vis[j] = 1; //vis[j] = 1 表示 j 不是素数欧拉筛d = 0;memset(flag, 0, ...原创 2018-09-02 15:02:34 · 304 阅读 · 0 评论 -
Lucas定理
C_n^m\mod p(p为素数) Lucas(n,m)=C(n,m)%p=C(n%p,m%p)*Lucas(n/p,m/p)%p 待补原创 2018-08-27 21:24:49 · 188 阅读 · 0 评论 -
欧几里得,扩展欧几里得,费马小定理:
欧几里得int gcd(int a,int b){ int r=a%b; while (r) { a=b;b=r;r=a%b; } return b;}https://blog.youkuaiyun.com/cqlf__/article/details/7953039扩展欧几里得int exgcd(int a,int b){ ...原创 2018-08-27 16:58:42 · 190 阅读 · 0 评论 -
Scoop water——CSU1320——卡特兰数
Description zzy今天刚买了两个水瓢A和B,容量都是为1升,童心未泯的他打算用这个水瓢来玩游戏。 首先zzy准备了一个容量可看作无穷大的水缸,刚开始水缸是空的,然后用水瓢A往水缸里加水,用水瓢B把水缸里的水舀出去,当使用 水瓢B把水舀出去时水缸里必须要至少有1升的水。这样子使用N次水瓢A,也使用N次水瓢B,最后水缸会依旧空的。Input 输入有多个例子,直到文件结...原创 2018-07-18 10:23:46 · 217 阅读 · 0 评论 -
Buy the Ticket——卡特兰数,大数,阶乘
DescriptionThe "Harry Potter and the Goblet of Fire" will be on show in the next few days. As a crazy fan of Harry Potter, you will go to the cinema and have the first sight, won’t you? Suppose the...原创 2018-07-17 16:23:29 · 343 阅读 · 0 评论 -
System Overload---zoj1088
Recently you must have experienced that when too many people use the BBS simultaneously, the net becomes very, very slow. To put an end to this problem, the Sysop has developed a contingency sc...原创 2018-07-17 14:55:44 · 244 阅读 · 0 评论 -
Flip and Shift
This puzzle consists of a random sequence of m black disks and n white disks on an oval-shaped track, with a turnstile capable of flipping (i.e., reversing) three consecutive disks. In Figure 1, t...原创 2018-07-17 11:10:47 · 300 阅读 · 0 评论 -
小兔的棋盘——hdu 2067——卡塔兰数
Description小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很长时间都没想出来,现在想请你帮助小兔解决这个问题,对于你来说应该不难吧! In...原创 2018-07-17 09:17:51 · 219 阅读 · 0 评论 -
HDU 1299 Diophantus of Alexandria(质数筛)
Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first mathematicians to study equations where variables were restricted to integral values. In honor of him,...原创 2018-09-11 10:27:41 · 173 阅读 · 0 评论