题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1078 题目大意: 题目中的k表示横向或者竖直最多可曾经进的距离,不可以拐弯.老鼠的出发点是(1,1). 对于老鼠从当前点可以到达的点.筛选出从这些点到达当前点所能获得的cheese的最大值. 思路:记忆化搜索. 假设对于当前的点.没有被搜索过(dp[i][j]=0).那么就对其进行搜索.搜索过程中记录下最优的解. 假设已经被搜索过了,就能够直接利用已经记录的值来进行推断 了,不须要再去搜索. 假设…
题目链接:点击链接 题目大意:老鼠从(0,0)出发,每次在同一个方向上最多前进k步,且每次到达的位置上的数字都要比上一个位置上的数字大,求老鼠经过的位置上的数字的和的最大值 #include<stdio.h> #include<string.h> #define max(a,b) a>b?a:b int n; int k;//前进的步数 int map[105][105]; int ans[105][105];//记忆化搜索,保存中间搜索结果 int search(int x…
http://acm.hdu.edu.cn/showproblem.php?pid=1078 题意: 一张n*n的格子表格,每个格子里有个数,每次能够水平或竖直走k个格子,允许上下左右走,每次走的格子上的数必须比上一个走的格子的数大,问最大的路径和. 记忆化搜索 #include <iostream> #include <string.h> #include <stdio.h> using namespace std; ][] = { {, },{ -, }, {, }…
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8610    Accepted Submission(s): 3611 Problem Description FatMouse has stored some cheese in a city. The city can be considere…
FatMouse and Cheese FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At each grid location Fatmouse has hid between 0 a…
题意:给出n*n的二维矩阵,和k,老鼠每次最多走k步,问老鼠从起点(0,0)出发,能够得到的最大的数(即为将每走过一点的数都加起来的和最大)是多少 和上一题滑雪一样,搜索的方向再加一个循环 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<algorithm> using namespace std; typedef long long…
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9499    Accepted Submission(s): 4007 Problem Description FatMouse has stored some cheese in a city. The city can be considered…
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2394 Accepted Submission(s): 913 Problem Description FatMouse has stored some cheese in a city. The city can be considered as a…
/* hdu 1078 QAQ记忆化搜索 其实还是搜索..因为里面开了一个数组这样可以省时间 (dp[x][y]大于0就不用算了直接返回值) */ #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int n,l; ][]; ][]; ,,-,}; ,,,-}; bool check(int x,int y) { &&x<n&&…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078 题意就是有n*n的地图,每个地方都有食物,数量不同,老鼠在(0,0)的位置每次它最多跳 k 步,每次吃只能吃比当前位置食物多的食物,求最大值: #include<stdio.h> #include<string.h> #include<stdlib.h> #include<algorithm> using namespace std; #define N…