http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3954 A seven segment code of permutation p is a set of seven segment code derived from th ...
分类:
其他好文 时间:
2017-04-11 00:56:00
阅读次数:
457
【题目链接】 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3949 【题目大意】 给出一棵根为1的树,每条边边长为1,请你从根连一条边到某个点, 使得各点到根距离的总和最小,求这个最小距离和 【题解】 假设从1连到x,那么 ...
分类:
其他好文 时间:
2017-04-11 00:40:39
阅读次数:
363
呵呵呵,神奇的位运算,当时就一脸懵逼地找规律,并不知道&和<<还能有这效果,,,,,,这里就是记录每个数字二进制最大位数的1的位置i,只要其他的数字的i的前面没有1,并且i或者及其以后是0,那么两个数字抑或后肯定比其中任何一个大 ...
分类:
其他好文 时间:
2017-04-10 23:25:06
阅读次数:
223
二分图匹配。 先检查每个数字$1$的个数是否满足条件,不满足直接就是无解。剩下的情况可以建立二分图,如果现在的某一列可以对应于原图的某一列,那么建边。如果二分图的最大匹配是$7$,则有解,否则误解。 ...
分类:
其他好文 时间:
2017-04-10 21:47:58
阅读次数:
208
暴力,预处理。 先计算出一个平年有多少$9$,一个闰年有多少$9$。一组数组,头和尾暴力枚举一下,中间的直接算。 ...
分类:
其他好文 时间:
2017-04-10 20:14:56
阅读次数:
224
排序。 枚举每一个格子,计算这个格子在多少矩阵中是鞍点,只要计算这一行有多少数字比他大,这一列有多少数字比他小,方案数乘一下就是这个格子对答案做出的贡献。 ...
分类:
其他好文 时间:
2017-04-10 20:13:36
阅读次数:
157
If we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y ...
分类:
其他好文 时间:
2017-04-10 19:31:34
阅读次数:
320
In computer science, the Knuth-Morris-Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text s ...
分类:
其他好文 时间:
2017-04-10 19:22:50
阅读次数:
162
If we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y ...
分类:
其他好文 时间:
2017-04-09 22:41:21
阅读次数:
474