hdu4857逃生第一题是拓扑排序,不是按照字典序最小输出,而是要使较小的数排在最前面。。赛后弄了好久,才比较明白,我一直以为反向建图,i从1到n,开始深搜dfs( i ),对i点的边,由小到大继续搜一下,同时标记搜过的数,搜过之后就不再搜,搜到底之后ans[cnt++] = u;这样顺序输出就是答...
分类:
其他好文 时间:
2014-07-22 22:47:36
阅读次数:
261
1、拓扑排序,要求输出小的数尽量靠前,而不是字典序...
分类:
其他好文 时间:
2014-07-22 22:39:33
阅读次数:
196
逃生
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 569 Accepted Submission(s): 154
Problem Description
糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通...
分类:
其他好文 时间:
2014-07-22 22:38:53
阅读次数:
241
Problem 2156 Climb Stairs
Problem Description
Jason lives on the seventh floor. He can climb several stairs at a time, and he must reach one or more specific stairs before he arrives home becau...
分类:
其他好文 时间:
2014-07-22 14:36:28
阅读次数:
211
Round Numbers
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 8590
Accepted: 3003
Description
The cows, as you know, have no fingers or thumbs and thus a...
分类:
其他好文 时间:
2014-07-22 14:30:24
阅读次数:
168
思路:定义f(x)为 Ai & x==x 的个数,g(x)为x表示为二进制时1的个数,最后答案为 。为什么会等于这个呢:运用容斥的思想,如果 我们假设 ai&x==x 有f(x)个,那么 这f(x)个 组成集合的子集 & 出来是 >=x那么我们要扣掉>x的 。。。 因为这里我们要求的是 & 之后等于...
分类:
其他好文 时间:
2014-07-22 00:36:33
阅读次数:
232
Python学习笔记 1.基础知识 · 用于实现整除的操作符:// · 幂运算符:** · Python中变量没有类型。类型的强制转换使用函数int(32.9);而C中强制转换使用(int)32.9 · round():将浮点数四舍五入;floor():向下取整;ceil():向上取整 · 跨多行的...
分类:
编程语言 时间:
2014-07-22 00:13:37
阅读次数:
393
Round Numbers:如果n换成二进制后,0的个数大于等于1的个数
求x-y范围内Round Numbers有几个...
分类:
其他好文 时间:
2014-07-21 23:46:54
阅读次数:
196
n、k,表示n个点,每个点有一个值,记c = max(abs(n[i] - n[i + 1])),要求只能将数组中的至多k个元素值改变(变成任意值),求c的最小值...
分类:
其他好文 时间:
2014-07-21 15:43:15
阅读次数:
234
Problem Description
The professors of the Bayerische Mathematiker Verein have their annual party in the local Biergarten. They are sitting at a round table each with his own pint of beer. As a ceremo...
分类:
其他好文 时间:
2014-07-21 11:31:44
阅读次数:
252