cdoj 韩爷的情书 有向图 欧拉路径】的更多相关文章

//欧拉回路 解法:首先判断欧拉回路存在性:1.连通 2.没有出度入度相差大于1的点 3.如果有出度入度相差等于1的点那么必须有两个,一个出度大于入度作为起点,一个入度大于出度作为终点. 在确定了起点后,用dfs法找欧拉回路. 关于dfs找欧拉回路:其实就是欧拉回路存在的充要性定理的证明,先走到底(最后走到的一定是终点,如果重点起点固定的话),然后再递归回来找圈,因为图连通,后来找到的圈也可以加到里面. #include<cstdio> #include<iostream> #in…
H - 韩爷的情书 Time Limit: 6000/2000MS (Java/Others)     Memory Limit: 262144/262144KB (Java/Others) Submit Status 某年某月某日,韩爷被妹子表白了\o/ 同时,韩爷收到了来自妹子的情书.在好奇心的驱使下,众人想要一览究竟. 显然,羞涩韩爷是不会把情书直接拿出来的. 假设情书长度为n+2,韩爷从中提取出n个长度为3的连续字符串,分给了n个人. 现在这n个人向你求助,能否帮他们把情书恢复出来. I…
N - 韩爷的梦 Time Limit: 200/100MS (Java/Others)     Memory Limit: 1300/1300KB (Java/Others) Submit Status 一天,韩爷去百度面试,面试官给了他这么一个问题. 给你2万个字符串,每个字符串长度都是100,然后把2万个字符串丢入一个 set< string >g 中,问最终set里含有多少个元素? g 是一个用来存储字符串.具有去重功能的容器,即相同字符串在 g 中只能保留一个. 两个字符串相等,当且…
韩爷的梦 Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/contest/show/61 Description 一天,韩爷去百度面试,面试官给了他这么一个问题. 给你2万个字符串,每个字符串长度都是100,然后把2万个字符串丢入一个 set< string >g 中,问最终set里含有多少个元素? g 是一个用来存储字符串.具有去重功能的容器,即相同字符串在 g 中只能保留一个. 两个字符串相等,…
http://acm.uestc.edu.cn/#/problem/show/1092 题意:略 思路: 做的第一道字符串hash的题,真是菜啊,还是看了几篇题解才会做的.字符串hash感觉就是函数的选取和改变模数和基数使得冲突消失,这题嘛,就是wa了就换一组模数和基数. 实际上也不是很懂.就是算出每一个字符串的hash值,然后将其保存,最后sort一下,统计其中不同元素的个数. p = 1e6 + 7; mod = 1e9 + 9;这对组合就过了,但是数组没有下标越界也很迷啊.代码: #inc…
Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us.There is a large number of magnetic p…
Play on Words Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8768   Accepted: 3065 Description Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there…
Catenyms Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8756   Accepted: 2306 Description A catenym is a pair of words separated by a period such that the last letter of the first word is the same as the last letter of the second. For e…
/////////////////////////////////////////////////////////////////////////////////////////////////////// 作者:tt267 声明:本文遵循下面协议自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0 查看本文更新与讨论请点击:http://blog.csdn.net/tt2767 链接被删请百度: CSDN tt2767 ////////////////…
Play on Words Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4263    Accepted Submission(s): 1384 Problem Description Some of the secret doors contain a very interesting word puzzle. The team…