Fast Power Algorithm / Fast Matrix Exponeitation
Part 1 Just only number.We know xa+b = xa * xb.e.g. 513 = 58 x 54 x 51So we have this code:long double myPow(long double x, int pow) {
bool flag=0;
if (pow<0)
flag=1, pow=-pow;
...
Network Flow Template (SAP)
This algorithm was named for Shortest Augmenting Path (SAP).. From an OIer, at about year 2010.IntroductionTotal of n nodes, m edges.S is source node means 'source'.T is sink node means 'target'.m...
Treap
简介Treap is Tree + Heap, each node have two property : Key, and Priority.Using key can format the Binary tree, and using Priority can make a heap.代码struct Treap {
int key,pri;
int cnt;
T...
Heap+Dijkstra
练习题:http://poj.org/problem?id=3169Dijkstra的过程InitializationSet dist[all]=∞ and set dist[S]=0;
push S into Heap;Mainwhile (!heap.empty()) {
HeapItem p=heap.pop();
if (dist[p] != p.distence) ...
8月 迪拜和阿布扎比
这个游记拖了很久,一些经验之谈。2017年8月21日,只身一人来到迪拜,后又去了阿布扎比,很热,物价不贵,安全。网上游记不多,写点干货供参考。0x01 注意事项钱:汇率合适,网上的经验是取现手续费每笔10块钱rmb?国内的银联卡能在当地几乎所有ATM直接取钱,自动换汇率,即使ATM机没有贴银联标识。许多吃饭的小店不接受银行卡(Yelp上说的),公交车均不可使用现金(后文会说)。参考价格:廉价...