ACM__数论&&数学技巧
文章平均质量分 79
Spectacules
每一段代码都是艺术品
展开
-
HDU 2925 Musical Chairs(约瑟夫环问题)
Musical ChairsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1201 Accepted Submission(s): 689Problem DescriptionIn the tradition原创 2015-07-27 18:03:37 · 553 阅读 · 0 评论 -
自我探讨 国王和狱吏(合数)
课堂上老师提到的一个问题: 某国王对囚犯进行大赦,让一狱吏n次通过一排锁着的n间牢房,每通过一次,按所定规则转动n间牢房中的某些门锁, 每转动一次, 原来锁着的被打开, 原来打开的被锁上;通过n次后,门锁开着的,牢房中的犯人放出,否则犯人不得获释。 转动门锁的规则是这样的,第一次通过牢房,要转动每一把门锁,即把全部锁打开;第二次通过牢房时,从第二间开始转动,每隔一间转动一次;第k原创 2015-09-23 00:21:21 · 1133 阅读 · 0 评论 -
HDU 3398 String(整数唯一分解定理)
StringProblem DescriptionRecently, lxhgww received a task : to generate strings contain '0's and '1's only, in which '0' appears exactly m times, '1' appears exactly n times. Also, any prefix原创 2015-10-07 15:46:16 · 496 阅读 · 0 评论 -
HDU 1212 Big Number(大数取模)
Big NumberProblem Description As we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to calculate A mod B.To make the pr原创 2015-10-07 21:42:31 · 486 阅读 · 0 评论 -
HDU 1018 Big Number(斯特林公式)
Big NumberProblem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this pr原创 2015-10-07 21:13:59 · 513 阅读 · 0 评论 -
HDU 1207 汉诺塔II(递推)
汉诺塔IIProblem Description经典的汉诺塔问题经常作为一个递归的经典例题存在。可能有人并不知道汉诺塔问题的典故。汉诺塔来源于印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往上按大小顺序摞着64片黄金圆盘。上帝命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一回只能移动一个圆盘。有预言说原创 2015-09-17 11:11:37 · 488 阅读 · 0 评论 -
HDU 3792 Twin Prime Conjecture(素数筛法 + 树状数组)
Twin Prime ConjectureProblem DescriptionIf we define dn as: dn = pn+1-pn, where pi is the i-th prime. It is easy to see that d1 = 1 and dn=even for n>1. Twin Prime Conjecture states that "There原创 2015-10-04 20:54:46 · 564 阅读 · 0 评论 -
UVA 11300 Spreading the Wealth (数学推导)
ProblemA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properties to coin原创 2015-09-11 17:58:54 · 373 阅读 · 0 评论 -
HDU 2068 RPG的错排(错排+排列组合)
RPG的错排Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;......可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的原创 2015-08-25 10:45:44 · 579 阅读 · 0 评论