Navigation Nightmare 题目链接:virtual judge poj Farmer John's pastoral neighborhood has N farms (2 <= N <= 40,000), usually numbered/labeled 1..N. A serie ...
分类:
Web程序 时间:
2020-04-28 16:51:33
阅读次数:
64
"题目" For their physical fitness program, $N (2 ≤ N ≤ 1,000,000)$ cows have decided to run a relay race using the $T (2 ≤ T ≤ 100)$ cow trails througho ...
分类:
其他好文 时间:
2020-04-28 15:29:35
阅读次数:
57
This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the fi ...
分类:
其他好文 时间:
2020-04-28 00:48:51
阅读次数:
67
给定 matrix = [ [1,2,3], [4,5,6], [7,8,9]], 原地旋转输入矩阵,使其变为:[ [7,4,1], [8,5,2], [9,6,3]] class Solution(object): def rotate(self, matrix): """ :type matri ...
分类:
其他好文 时间:
2020-04-28 00:07:29
阅读次数:
59
本文始发于个人公众号: TechFlow ,原创不易,求个关注 今天是LeetCode专题的第32篇文章,我们一起看的是LeetCode的第54题——Spiral Matrix。 首先解释一下题意,这个Spiral是螺旋的意思,据说英文版的漫画里,把鸣人的螺旋丸就翻译成Spiral Sphere.. ...
分类:
其他好文 时间:
2020-04-27 22:45:01
阅读次数:
69
Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1]. The score of a pat ...
分类:
其他好文 时间:
2020-04-27 09:21:15
阅读次数:
58
POJ2955 Brackets 题目链接:https://vjudge.net/problem/POJ-2955 题意:求最长的合法括号子序列长度 思路: 基础的区间DP问题。用f[i][j]表示第i到第j区间内的最长合法括号子序列长度。 首先要进行预处理: 如果当前区间 [l,r] 的左端点和右 ...
分类:
其他好文 时间:
2020-04-26 21:05:13
阅读次数:
51
A.Lake Counting(POJ 2386) 题意: 由于最近的降雨,农夫约翰田地的各个地方都有水汇聚,用N x M(1 <= N <= 100; 1 <= M <= 100)的矩形表示。每个方格包含水('W')或干燥土地('。')。农夫约翰想弄清楚他的田地里形成了多少个池塘。池塘是一组相连的 ...
分类:
其他好文 时间:
2020-04-26 17:00:32
阅读次数:
89
题目链接:http://poj.org/problem?id=3977 前言 如无法区分折半枚举,二分, "请点击这里" 分析 这题我感觉出了是用枚举,毕竟数据范围很小,但是,集合中每个元素都有可能被选或者不被选,根据计数原理应该会有$2^{35} 1$种情况,需要刨除空集,枚举显然是会T掉,那怎么 ...
分类:
其他好文 时间:
2020-04-26 13:48:26
阅读次数:
78
题目描述: Input: Output: 题意:给定n个数,求出使得总和的绝对值最小的最小集合,该集合是给定的n个数的子集,并输出这个最小总和和集合内的元素个数,在满足总和最小的前提下要求元素个数最小。 思路:这道题如果用暴力来写,由于每个数都有两种情况,故硬枚举就是2^n的效率,但n是小于等于三十 ...
分类:
其他好文 时间:
2020-04-25 13:01:03
阅读次数:
61