Generalized Palindromic Number
Time Limit: 2 Seconds
Memory Limit: 65536 KB
A number that will be the same when it is written forwards or backwards is known as a palindromic number. For ...
分类:
其他好文 时间:
2014-09-12 11:59:43
阅读次数:
186
题意:在某些点上安装首次访问时候会报警的机器,给出报警嗲你的顺序,问是否合法。
思路:按所给的序列,每个进来时判断这个点目前能否达到(第一个可达总是),若能,则该点进行扩展遍历所有没有报警器的点,遇到有的报警器的标记可达就返回。
预判:判断原图连图性。
#include
#include
#include
#include
#include
using namespace s...
分类:
其他好文 时间:
2014-09-12 10:17:53
阅读次数:
240
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5349
比赛的时候没看这道题,遗憾,不过想到算法不难,但是写代码比较考代码能力,我自己写了两次都不行,还是看了别人代码,写下了这个
学到:
1、hash字符串第一个下表为0的空起来,写起来方便
2、hash匹配的全部情况就是以text串的所有位置为起点做匹配,当text比...
分类:
其他好文 时间:
2014-09-12 02:25:22
阅读次数:
258
暴力模拟细节处理很重要。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 char s1[100],s[100]; 7 int len1,len; 8 int t; ...
分类:
其他好文 时间:
2014-09-11 23:44:42
阅读次数:
430
找规律....
Abs Problem
Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge
Alice and Bob is playing a game, and this time the game is all about the absolute value!
Alice ...
分类:
其他好文 时间:
2014-09-11 22:28:12
阅读次数:
233
We Need Medicine
Time Limit: 10 Seconds
Memory Limit: 65536 KB Special Judge
A terrible disease broke out! The disease was caused by a new type of virus, which will lead to lethal l...
分类:
其他好文 时间:
2014-09-11 21:02:22
阅读次数:
204
搜索....
Machine
Time Limit: 2 Seconds Memory Limit: 65536 KB
In a typical assembly line, machines are connected one by one. The first machine's output product will be the second mac...
分类:
其他好文 时间:
2014-09-11 20:59:42
阅读次数:
186
这道题就题意来说其实就是一道简单的记录路径的0,1背包,告诉你n个物品,每种物品只能取一次,再有q个询问,问你是否能在满足选出物品的w之和为m的情况下,满足t之和为s的情况,若可以则任意输出一种方案。
因此我们可以设计状态,dp[i][j][k]为前i个物品选出部分,当t之和为j时,w之和为k的情况能否满足,若存在方案则为1,不存在则为0。而状态的转移方程也是很简单。
dp[i][j+t[i]...
分类:
其他好文 时间:
2014-09-11 19:23:52
阅读次数:
173
题意:给定一个n个点,m条边的图,其中k个点上有探测器
再给定一个探测器第一次被遍历的序列,问是否存在一种遍历顺序使得满足给定序列且遍历完所有点
思路:从第一个被遍历的探测器开始dfs,每次访问到探测器遍停止,访问到非探测器节点便搜下去。结束后判断给定序列下个探测
器是否被访问过,若没有,说明无法不通过 其他 探测器到达此探测器,无解。若被访问过,继续dfs此结点。
这样d...
分类:
其他好文 时间:
2014-09-11 12:33:31
阅读次数:
168
ZOJ 3817 Chinese Knot
题目链接
思路:万万没想到这题直接hash+暴力剪枝就可以了,把4个串正逆都hash出来,然后每次枚举起点去dfs记录下路径即可,剪枝为如果一旦有一点不匹配就不往后搜(这个很容易想到0 0)
代码:
#include
#include
#include
#include
using namespace std;
type...
分类:
其他好文 时间:
2014-09-11 11:16:41
阅读次数:
196