08 2016 档案
摘要:题目链接: http://acm.hust.edu.cn/vjudge/problem/450060 题目大意: 给出一个长度为n的序列a (a include include include include define rep(i,x,y) for (int i=x;i=x;i ) define
阅读全文
摘要:堆(heap) push:插入一个元素,O(logn) top:返回当前元素最小值,O(1) pop:将当前最小元素弹出队列,O(logn) 代码: include include include include define rep(i,x,y) for (int i=x;i=x;i ) usin
阅读全文
摘要:树的Prufer编码及应用: http://www.mengchunlei.net/2015/06/21/%E6%A0%91%E7%9A%84prufer%E7%BC%96%E7%A0%81/ http://blog.csdn.net/bingshangjiguang/article/details
阅读全文
摘要:在大多数数论的朴素筛法中,时间复杂度通常为O(nloglogn),尽管已经十分快了,但在有些情况下不适用。为此欧拉提出了一种筛法,能够在O(n)时间内求出1~n的所有素数,而且有很大拓展空间。 代码: void get_prime(int n) { memset(is_prime,true,size
阅读全文
摘要:题目链接:http://acm.hust.edu.cn/vjudge/problem/38379 题目大意: 给出一个n m的矩阵,其中一些格子填了数,一些格子没有。现要求将未填数的格子填上数字,使得矩阵从左上到右下(不允许向左或上走)的任意一条路径上没有两个格子数字相同,数字范围为1~K。 1 i
阅读全文

浙公网安备 33010602011771号