首页 > TAG信息列表 > 2763

POJ-2763 Housewife Wind

Housewife Wind 树链剖分 利用树中每个点都只有一个父节点的性质,将边权化为点权,然后树链剖分 LCA,套一个线段树维护权值 注意在同一链的时候,LCA 的点权是不计算在内的 这题卡时间卡的很紧,如果 TLE,尝试改成 scanf printf #include <iostream> #include <cstdio> #include <algorithm

POJ 2763"Housewife Wind"(DFS序+树状数组+LCA)

  传送门   •题意   一对夫妇居住在 xx村庄,给村庄有 $n$ 个小屋;   这 $n$ 个小屋之间有双向可达的道路,不会出现环,即所构成的图是个树;   从 $a_i$ 小屋到 $b_i$ 小屋需要花费 $w_i$ 时间;   初始,女主角在 $s$ 号小屋,有 q 次询问,每次询问为以下两种的一个: 0 u : 她有

POJ - 2763 Housewife Wind 【树链剖分+边权】

After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts connected by bidirectional roads. We say that huts in the same pair directl

POJ 2763 Housewife Wind LCA+树状数组 dfs序

http://poj.org/problem?id=2763 After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts connected by bidirectional roads. We say that

阶乘的素因子分解(SOJ 2763)

SOJ 2763: Factorial 问题:给出两个数$N(1\le N\le 10^{9})$和$B(2\le B\le 100000)$,求解$N!$以$B$为基表达时末尾$0$的个数。 例子:(1)$7!$以$10$为基时等于$5040$,此时末尾有$1$个$0$.      (2)$7!$以$2$为基时表示为$1001110110000$,此时末尾有$4$个$0$.  分析:以$B$为基时,$N!