思路: 将4个串每个串都反向这样得到新的四个串一共8个串,对于母串每个位置检测这个串能不能放进去,hs或者后缀数组都可以。然后dp[i][j] (0#include#include#include#include#include#include#include#include#include#inc...
分类:
其他好文 时间:
2014-09-08 10:49:36
阅读次数:
314
Untrusted PatrolTime Limit: 3 Seconds Memory Limit: 65536 KBEdward is a rich man. He owns a large factory for health drink production. As a matter ...
分类:
其他好文 时间:
2014-09-08 10:44:56
阅读次数:
309
Description
A number that will be the same when it is written forwards or backwards is known as a palindromic number. For example, 1234321 is a palindromic number.
We call a number generalized p...
分类:
其他好文 时间:
2014-09-07 22:31:15
阅读次数:
241
n个点,m条双向边,k个传感器。
首先判断l...
分类:
其他好文 时间:
2014-09-07 21:13:55
阅读次数:
260
题目连接 :http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5348牡丹江网络赛的题,比赛的时候想到做法的,但是一直没调出来,赛后也调了些时间,最近代码能力堪忧啊~有好多做法, 我的做法是二分下界low,即判断在low到n-1之间...
分类:
其他好文 时间:
2014-09-07 21:07:25
阅读次数:
270
Untrusted PatrolTime Limit:3 Seconds Memory Limit:65536 KBEdward is a rich man. He owns a large factory for health drink production. As a matter of co...
分类:
其他好文 时间:
2014-09-07 21:06:25
阅读次数:
363
感觉可以用BFS撸,然后就撸了,样例无限不过,代码能力真是弱。。#include #include #include #include #include using namespace std;const int bufsize = 128;char buf[bufsize][bufsize];st...
分类:
其他好文 时间:
2014-09-07 20:59:35
阅读次数:
320
由于一个框框只有4种状态,总状态数只有4^9,bfs可解。
麻烦的地方就在于模拟。
我的状态的存法是,将初始状态看做000000000,若顺时针旋转一次就+1, 3+1=0。
bfs的过程中,需要套一个dfs计算旋转当前框框会影响到哪些框。
有个地方要注意,就是目标状态其实不止一种,因为有些框框旋转之后不变,我们必须把所有可能的目标状态都计算出来,样例的中间那个框框就是这种情况。
#in...
分类:
其他好文 时间:
2014-09-07 19:53:05
阅读次数:
276
题目链接:点击打开链接
#include
#include
#include
#include
using namespace std;
const int N = 55;
char a[N], b[N];
int main() {
int T;
scanf("%d", &T);
while(T-- > 0) {
scanf("%s", a);
int Len = ...
分类:
其他好文 时间:
2014-09-07 19:52:45
阅读次数:
186
题目链接:点击打开链接
题意:
给定一个数n
找一个最大的数u使得u
枚举前面有多少位是一样的。然后分类讨论。啪啦啪啦
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
const int N = 22;
int pie[N], piesize;
ll ...
分类:
其他好文 时间:
2014-09-07 19:52:35
阅读次数:
252