小坏蛋_千千

I was caught in a heavy rain!

HDU 6041 I Curse Myself (仙人掌图)

Description There is a connected undirected graph with weights on its edges. It is guaranteed that each edge appears in at most one simple cycle. ...

2017-07-31 21:48:12

阅读数:248

评论数:0

『数论』乘法逆元

在求解除法取模问题 (a/b)%m(a/b)\%m 时,我们可以转化为 (a%(b×m))/b(a\%(b×m))/b ,但是如果 bb 很大,则会出现爆精度问题,所以我们避免使用除法直接计算。可以使用逆元将除法转换为乘法:假设 bb 存在乘法逆元,即与 mm 互质(充要条件)。设 cc 是 bb...

2017-07-31 11:47:27

阅读数:260

评论数:0

HDU 3594 Cactus (仙人掌图、Tarjan)

Description It is a Strongly Connected graph. Each edge of the graph belongs to a circle and only belongs to one circle. We call this ...

2017-07-30 17:05:19

阅读数:165

评论数:0

HDU 6044 Limited Permutation (组合数+逆元)

Description As to a permutation p1,p2,⋯,pn from 1 to n, it is uncomplicated for each 1≤i≤n to calculate (li,ri) meeting the condition that min(pL,p...

2017-07-30 12:54:40

阅读数:281

评论数:0

HDU 6047 Maximum Sequence (贪心)

Description Steph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the...

2017-07-28 18:16:12

阅读数:307

评论数:0

HDU 6053 TrickGCD (莫比乌斯函数)

Description You are given an array AA , and Zhu wants to know there are how many different array BB satisfy the following conditions? 1≤Bi≤...

2017-07-28 14:05:10

阅读数:581

评论数:0

HDU 6055 Regular polygon (找正方形)

Description On a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can m...

2017-07-27 18:37:26

阅读数:761

评论数:0

HDU 6050 Funny Function (规律+逆元)

Description Function Fx,yF_{x,y} satisfies: F1,1=F1,2=1F_{1,1}=F_{1,2}=1 F1,i=F1,i−1+2∗F1,i−2 (i>=3)F_{1,i}=F_{1,i-1}+2*F_{1,i-2}\ (i&...

2017-07-27 18:32:07

阅读数:526

评论数:4

HDU 6040 Hints of sd0061 (技巧)

Description sd0061, the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal with...

2017-07-27 11:25:09

阅读数:357

评论数:0

codevs 2370 小机房的树 (LCA)

Description 小机房有棵焕狗种的树,树上有N个节点,节点标号为0到N-1,有两只虫子名叫飘狗和大吉狗,分居在两个不同的节点上。有一天,他们想爬到一个节点上去搞基,但是作为两只虫子,他们不想花费太多精力。已知从某个节点爬到其父亲节点要花费 c 的能量(从父亲节点爬到此节点也相同),他们...

2017-07-27 09:40:03

阅读数:160

评论数:0

HDU 6035 Colorful Tree (树形dp)

Description There is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci. The pa...

2017-07-26 20:35:55

阅读数:259

评论数:0

HDU 6038 Function (数学)

Description You are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1. Define that the domain of function f is the set of ...

2017-07-26 14:11:26

阅读数:779

评论数:0

HDU 6034 Balala Power! (贪心)

Description Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could chan...

2017-07-26 10:54:43

阅读数:176

评论数:0

codevs 1036 商务旅行 (LCA)

Description 某首都城市的商人要经常到各城镇去做生意,他们按自己的路线去做,目的是为了更好的节约时间。 假设有N个城镇,首都编号为1,商人从首都出发,其他各城镇之间都有道路连接,任意两个城镇之间如果有直连道路,在他们之间行驶需要花费单位时间。该国公路网络发达,从首都出发能到...

2017-07-25 10:23:42

阅读数:198

评论数:0

POJ 1470 Closest Common Ancestors (LCA)

Description Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the close...

2017-07-24 16:19:38

阅读数:140

评论数:0

POJ 1330 Nearest Common Ancestors (LCA)

Description A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, ...

2017-07-24 15:29:36

阅读数:197

评论数:0

hihocoder 1532 最美和弦 (dp)

描述 某个夜晚,Bob将他弹奏的钢琴曲录下来发给Jack,Jack感动之余决定用吉他为他伴奏。 我们可以用一个整数表示一个音符的音高,并可认为Bob弹奏的曲子是由3N个整数构成的一个序列。其中每个整数的取值范围是[-200, 200]。 Jack共弹奏 N 个和弦,每个和弦...

2017-07-24 10:32:50

阅读数:249

评论数:0

hihocoder 1531 德国心脏病 (模拟)

描述 Jack在和朋友们玩德国心脏病。 德国心脏病的游戏牌分为水果牌和动物牌。水果只有4种:香蕉、草莓、樱桃、柠檬,每张水果牌上会有种类不定、总数目1-5的水果;动物只有3种:猴子、大象、猪,每张动物牌上有且仅有一只动物。 n名玩家绕圈就座,第一轮游戏从0号至n-1号轮流出...

2017-07-16 15:05:06

阅读数:476

评论数:0

HDU 3966 Aragorn's Story (树链剖分)

Problem Description Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies w...

2017-07-14 21:30:31

阅读数:162

评论数:0

『数据结构』RMQ 问题

RMQ (Range Minimum/Maximum Query),即区间最值问题 对于长度为 n 的数列,回复若干次查询,返回某个区间的最大(小)值

2017-07-13 21:56:13

阅读数:263

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭