A -Painting the sticks因为不能覆盖涂/涂两次,所以就数数有几个三个一块儿就行了。#includeint a[100],ans ;int main(){ int n , t = 0 ; while (scanf("%d",&n)!=EOF) { for (...
分类:
其他好文 时间:
2014-07-16 20:37:36
阅读次数:
317
欧拉通路+并查集+字典树
题意是说 木棍两头有颜色,怎么排让它连成一串。颜色相同可以接起来。
最开始想用map水过去,一直TLE。怒点字典树天赋……花了一上午。
字典树不多介绍,我的节点开小了,CE好几次,才想起
“There is no more than 250000 sticks.”
“A word is a sequence of lowercas...
分类:
其他好文 时间:
2014-07-08 17:22:26
阅读次数:
180
Pick-up sticks
Problem Description
Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks,...
分类:
其他好文 时间:
2014-07-02 15:29:53
阅读次数:
295
Weekly golfers will find a bag that gives them enough space to do a lot of tees, balls, sticks, and whatever he deems necessary for the golf course. P...
分类:
其他好文 时间:
2014-06-30 20:52:39
阅读次数:
258
字典树+并查集。 1 #include 2 #include 3 #include 4 5 #define MAXN 500005 6 #define MAXL 11 7 #define TRIEN 26 8 9 typedef struct Trie { 10 ...
分类:
其他好文 时间:
2014-06-30 12:36:50
阅读次数:
224
They can usually be purchased in three sizes: £
5, £ 1 and a half pound bags. I even saw them to buy on eBay. Many companies are
cutting Tekpak bag of...
分类:
其他好文 时间:
2014-06-16 09:23:39
阅读次数:
443
这是一道让人泪奔的题,它深刻的说明了什么是剪枝,哪怕是再小的一个细节,一旦递归规模增大都会引发巨大的时间消耗,真是神题~
Sticks
时间限制:3000 ms | 内存限制:65535 KB
难度:5
描述George took sticks of the same length and cut them randomly until all part...
分类:
其他好文 时间:
2014-06-15 12:18:43
阅读次数:
174
给一个长度为 n
的杆子,切成小段卖出去,价格根据小段的长度不同而不同。下面是一个例子我们要通过切成小段卖出尽可能高的总价钱。问题是:How to decompose the
problem?Decomposition 的第一步是:第一刀切在哪?可以切在最左边(等于整根卖出去);可以切在位置1,位置...
分类:
其他好文 时间:
2014-06-10 16:43:26
阅读次数:
345
/*思路:类似图论中“一笔画”问题,两根木棒的相连接的端点是一样的颜色,(a,b)--(b,c)--(c, d)....方法:trie树+并查集,
利用trie树建立字符串和某一个节点的映射,并将这些和字符串构成映射的节点建成图, 用并查集判断图的连通*/ 1 #include 2 #includ....
分类:
其他好文 时间:
2014-06-08 21:46:18
阅读次数:
330