
技巧
_zidaoziyan
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #341 (Div. 2)D. Rat Kwesh and Cheese
D. Rat Kwesh and Cheesetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWet Shark asked Rat Kwesh to generate three positive real numbers原创 2016-02-05 12:00:00 · 463 阅读 · 0 评论 -
二进制 快速count 1
转载:http://www.cnblogs.com/grenet/archive/2011/06/10/2077228.htmlhttp://www.cppblog.com/zenliang/articles/131761.html 原题:一个正整数,转成二进制后,这个二进制数包含多少个1? 这个问题在网上看过多次,几番思考,也没有什么好的办法。采用最转载 2016-02-04 18:50:20 · 358 阅读 · 0 评论 -
UVA 12657 Boxes in a Line(双向链表)
You have n boxes in a line on the table numbered 1 . . . n from left to right. Your task is to simulate 4kinds of commands:• 1 X Y : move box X to the left to Y (ignore this if X is already the le原创 2016-03-25 20:30:57 · 1423 阅读 · 0 评论 -
UVA 12664 Interesting Calculator
题意:给你x,y(0第一种操作给数字的末尾添加一个数字(0到9),添加不同的数字有不同的方案数,第二种操作给数字加上一个数(0到9),添加不同的数字有不同的方案数,第三种操作给数字乘上一个数(0到9),添加不同的数字有不同的方案数,思路:该数字变为x要么是先变为0,要么从x一直增大变为y,该开始写了bfs,有几个注意的地方,优先队列一定要以数字小的优先,不然一个数字可能原创 2016-03-25 20:54:39 · 373 阅读 · 0 评论 -
Hdu 5812 Distance(三种操作. 1.插入x 2.删除x 3.在集合中找到一个数y,使得y->x,每次能除以一个素数或者乘上一个素数,问最少的操作次数)
传送门:Hdu 5812 Distance 维护一个集合,有三种操作. 1.插入x 2.删除x 3.在集合中找到一个数y,使得y->x,每次能除以一个素数或者乘上一个素数,问最少的操作次数 思路:记f(x)为从1变到x所需要使用的最小的次数(可在线性筛的时候预处理) 要使y->x,即相当于对于每个x的因子z,从集合中找出一个y使得f[y/z]+f[x/z]最小,对于f[x/z]很好原创 2016-08-10 14:58:28 · 706 阅读 · 0 评论