Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-16 23:07:09
阅读次数:
196
题意:
n只虫子 m种交配方式 并给出m对交配 问 是否存在基… 0.0
思路:
简单的带权并查集 比POJ上那道食物链基础 而且用二分染色可以水过(由于性别只有两种…)
带权并查集可以利用权值维护不同集合间的“关系”
代码书写时注意getf函数中利用fa[x]更新x和根的关系 merge时注意fy权值利用x、y的权值的计算方法
代码:
#include...
分类:
其他好文 时间:
2014-07-15 12:30:45
阅读次数:
234
传送门:
POJ:点击打开链接
HDU:点击打开链接
A Bug's Life
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 27624
Accepted: 8979
Description
Background
Prof...
分类:
其他好文 时间:
2014-07-15 10:46:59
阅读次数:
274
控制语句if/elif/else if语句和一般编程语言一样,条件为true 执行 如: if true : print 'true' 0 and score90): print "your score is A" elif(score>60):...
分类:
编程语言 时间:
2014-07-13 09:44:41
阅读次数:
233
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:24:00
阅读次数:
258
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:23:16
阅读次数:
231
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:22:39
阅读次数:
181
hdu1829 A Bug's Life (并查集)...
分类:
其他好文 时间:
2014-07-08 19:38:19
阅读次数:
139
Description
During winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, comes out, and begins its new life.
Hol...
分类:
其他好文 时间:
2014-07-08 17:28:54
阅读次数:
256
题目大意:
求出在m个串中出现过大于m/2次的子串。
思路分析:
如果你只是直接跑一次后缀数组,然后二分答案扫描的话。
那么就试一下下面这个数据。
2
abcdabcdefgh
efgh
这个数据应该输出
efgh
问题就在于对于每一个串,都只能参与一次计数,所以在check的时候加一个标记数组是正解。
#include
#include
#inc...
分类:
其他好文 时间:
2014-07-03 15:35:12
阅读次数:
171