题目传送门:http://poj.org/problem?id=2704 Pascal's Travels Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5535 Accepted: 2500 Description An n x n game board is populated with integers, one nonnegative integer per square. The goal is to tr…
pid=1078">FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4811 Accepted Submission(s): 1945 Problem Description FatMouse has stored some cheese in a city. The city can…
Problem H Game Show Math Input: standard input Output: standard output Time Limit: 15 seconds A game show in Britain has a segment where it gives its contestants a sequence of positive numbers and a target number. The contestant must make a mathemati…
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14253 Accepted Submission(s): 6035 Problem Description FatMouse has stored some cheese in a city. The city can be considere…
历届试题 地宫取宝 时间限制:1.0s 内存限制:256.0MB 问题描述 X 国王有一个地宫宝库.是 n x m 个格子的矩阵.每个格子放一件宝贝.每个宝贝贴着价值标签. 地宫的入口在左上角,出口在右下角. 小明被带到地宫的入口,国王要求他只能向右或向下行走. 走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大,小明就可以拿起它(当然,也可以不拿). 当小明走到出口时,如果他手中的宝贝恰好是k件,则这些宝贝就可以送给小明. 请你帮小明算一算,在给定的局面下,他有多少种不…
本题有人写是DP,只是和DP还是有点区别的,应该主要是记忆化 Momoization 算法. 思路就是递归,然后在递归的过程把计算的结果记录起来,以便后面使用. 非常经典的搜索题目,这样的方法非常多题目考到的. 关键还是怎样把代码写清晰工整了,O(∩_∩)O~. #include <stdio.h> const int MAX_N = 101; int R, C; int arr[MAX_N][MAX_N]; int tbl[MAX_N][MAX_N]; inline int max(int…
Problem H: Two EndsIn the two-player game “Two Ends”, an even number of cards is laid out in a row. On each card, faceup, is written a positive integer. Players take turns removing a card from either end of the row andplacing the card in their pile.…
https://leetcode.com/problems/longest-increasing-path-in-a-matrix/ Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally o…