快速幂! 模板如下: 快速幂取模算法x 转载x 作者在后面x 所谓的快速幂,实际上是快速幂取模的缩写,简单的说,就是快速的求一个幂式的模(余)。在程序设计过程中,经常要去求一些大数对于某个数的余数,为了得到更快、计算范围更大的算法,产生了快速幂取模算法。 先从简单的例子入手:求= 几。 算法1.首先 ...
分类:
其他好文 时间:
2017-04-24 23:17:22
阅读次数:
215
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1552 Description On an alien planet, every extraterrestrial is born with a number. If the sum ...
分类:
其他好文 时间:
2017-04-21 20:31:27
阅读次数:
285
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1553 Description Give you a sequence of n numbers, and a number k you should find the max leng ...
分类:
其他好文 时间:
2017-04-21 20:22:52
阅读次数:
238
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1554 Description The SG value of a set (multiset) is the minimum positive integer that could n ...
分类:
其他好文 时间:
2017-04-21 20:07:50
阅读次数:
280
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1556 Description Jerry is caught by Tom. He was penned up in one room with a door, which only ...
分类:
其他好文 时间:
2017-04-21 19:59:07
阅读次数:
167
题目链接:https://cn.vjudge.net/problem/142542/origin Description You need to design road from (0, 0) to (x, y) in plane with the lowest cost. Unfortunatel ...
分类:
其他好文 时间:
2017-04-21 10:03:55
阅读次数:
216
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1547 Description Now ,there are some rectangles. The area of these rectangles is 1* x or 2 * x ...
分类:
其他好文 时间:
2017-04-21 00:04:23
阅读次数:
193
/* csu 1804 因为define和const总出错,到现在也不明白为什么 不知道define 和 const 出来的 mod 有什么区别 */ #include #include #include #include using namespace std; const int mod = 1... ...
分类:
其他好文 时间:
2017-04-14 17:47:31
阅读次数:
118
/// /// 根据指定尺寸得到按比例缩放的尺寸,返回true表示以更改尺寸 /// /// 图片宽度 /// 图片高度 /// 指定宽度 /// /// 指定高度 /// 返回true表示以更改尺寸 private bool GetPicZoomS... ...
C - 抛硬币 CSU - 1009 James得到了一堆有趣的硬币,于是决定用这些硬币跟朋友们玩个小游戏。在一个N行M列的表格上,每一个第i行第j列的格子上都放有一枚James的硬币,抛该硬币正面朝上的概率为Pij,所有抛硬币事件两两之间是相互独立的。 现在,玩家在M列硬币中,从每一列里各选择1枚 ...
分类:
其他好文 时间:
2017-04-08 12:41:05
阅读次数:
292