其他
题意 老鼠在一个小镇吃奶酪 城镇可以看成一个n*n的矩阵 其中每个格子都有一定数量的奶酪mat[i][j] 老鼠从(0,0) 开始吃 而且下个吃的格子里的奶酪必须比上个格子多 老鼠只能水平方向或者垂直方向走 而且每次走的距离不能超过k 求老鼠最多能吃多少奶酪
起点是固定的 比较容易 直接记忆化搜索
令d[i][j]表示以(i,j)为终点的最优解 那么对于所有(i...
预测一下这道题的结果,注意unsigned与signed
#include
#include
using namespace std;
int arr[]={1,2,3,4,5};
int main(){
for(int i=-1;i<sizeof(arr)/sizeof(arr[0]) - 1;i++)
cout<<arr[i+1]<<endl;
}
sizeof()返回的值是无符号数,...
解题报告
题目传送门
题意:
一个人有n个农场,他想从1到n去,有从n到1回来,要求路径最短,且没有走重复的路。
思路:
如果两次最短路感觉不行的,可以看成费用流,每一条路容量都是1,这样只要流量等于2就行了。
一次mcmf模版。
#include
#include
#include
#include
#define inf 0x3f3f3f3f
using namespac...
PowerShell 中的 replace
PowerShell 中的 replace,既是是字符串函数,还是运算符,类似于 like、match 之类。
比如,有一个字符串:
$a = "aaa.bbb?ccc=ddd"
要去掉问号后面的字符,可以用 repace 函数:
$a.replace("?ccc=ddd", "")
但是,replace 函数好像并不支持正则表达式,...
Alice and Bob
Accepted : 98
Submit : 324
Time Limit : 1000 MS
Memory Limit : 65536 KB
Problem Description
Alice and Bob always love to play games, so does thi...
首先建立Trie和失败指针,然后你会发现对于每个节点 i 匹配AGCT时只有以下几种情况:
i 节点有关于当前字符的儿子节点 j 且安全,则i 到 j找到一条长度为 1的路。
i 节点有关于当前字符的儿子节点 j 且 不安全,则i 到 j没有路。
i 节点没有关于当前字符的儿子节点
但是能通过失败指针找到一个安全的节点j,那么 i 到 j 找到一条长度为1的路。
关于节点安全的定义:
...
题意:。。。
典型的深搜,就是处理对角线的时候有些意外。
代码(注释掉的就是深搜,因为我不打表的话 TL):
#include
int c[11], n, ans;
int res[10] = {1, 0, 0, 2, 10, 4, 40, 92, 352, 724};
/*void dfs(int cur)
{
if(cur == n) {
++ans;
return ;
}
...
ZOJ Problem Set - 1456
Minimum Transport Cost
Time Limit: 2 Seconds
Memory Limit: 65536 KB
These are N cities in Spring country. Between each pair of cities there may be one transportat...
Given a 2D board and a word, find if the word exists in the grid....
Til the Cows Come Home
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 30007
Accepted: 10092
Description
Bessie is out in the field and wants to get back t...