摘要:
import pygameimport sys#初始化pygamepygame.init()size = width,height =600,400screen = pygame.display.set_mode(size)pygame.display.set_cap... 阅读全文
摘要:
import pygameimport sysfrom pygame.locals import * #导入所有的pygame变量,即不必再通过pygame.来调用# 初始化pygamepygame.init()clock = pygame.time.Clock() ... 阅读全文
摘要:
void PreorderTraversal(BinTree BT){ if(BT==NULL) return; printf(" %c",BT->Data); PreorderTraversal(BT->Left); PreorderTraversal... 阅读全文
摘要:
模板题。树状数组法:#includeusing namespace std;#define inf 0x3f3f3f3f#define ll long longconst int maxn=50005;const double eps=1e-8;int tree[ma... 阅读全文
摘要:
List Reverse( List L ){ List p,q; p=L; L=NULL; while(p){ q=p; p=p->Next; q->Next=L; L=q; } return L;} 阅读全文
摘要:
任务:对于数组A[1……n],在O(logn)的时间内完成以下任务:(1)给A【i】加上一个数(2)求A【1】+……A【i】的和说明:树状数组的第i个元素Tree[i]表示A[lowbit(i)+1……i]的和,其中lowbit(i)表示i的最低二进制位,即把高位的1... 阅读全文
摘要:
讲解:传送门const int maxn=50005;const double eps=1e-8;int tree[maxn];inline int lowbit(int x){ return x&-x;}void add(int x,int value) //... 阅读全文
摘要:
堆是完全二叉树,左孩子是2i,右孩子是2i+1。用途:堆排序,实现优先队列插入删除查找时间复杂度:O(logn)堆排序复杂度:O(nlogn)/**** **** **** **** **** ***** Function Name : 二叉堆* Descriptio... 阅读全文
摘要:
#includeusing namespace std;#define inf 0x3f3f3f3f#define ll long long#define fo freopen("in.txt","r",stdin)#define fc fclose(stdin)#d... 阅读全文
摘要:
公式:1 2 (d|n表示n是d的倍数)莫比乌斯函数:例题:HDU1695题目大意是这样的,给你 a , b , c , d , k 五个值 (题目说明了 你可以认为 a=c=1) x 属于 [1,b] ,y属于[1,d] 让你求有多少对这... 阅读全文