题目1004:Median 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:14162 解决:3887 题目描述: Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 1…
题目1464:Hello World for U 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3872 解决:1082 题目描述: Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as: h de ll rlowo…
题目1001:A+B for Matrices 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:15235 解决:6172 题目描述: This time, you are supposed to find A+B where A and B are two matrices, and then count the number of zero rows and columns. 输入: The input consists of several test cases, each st…
题目1437:To Fill or Not to Fill 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:1488 解决:345 题目描述: With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way fro…
题目1468:Sharing 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:2687 解决:550 题目描述: To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix.…
#include<iostream> #include<queue> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ][]; int main(){ int P,T,G1,G2,G3,GJ; while(cin>>P>>T>>G1>>G2>>…
链接 [蓝桥杯][2014年第五届真题]地宫取宝 题目描述 X 国王有一个地宫宝库.是 n x m 个格子的矩阵.每个格子放一件宝贝.每个宝贝贴着价值标签. 地宫的入口在左上角,出口在右下角. 小明被带到地宫的入口,国王要求他只能向右或向下行走. 走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大,小明就可以拿起它(当然,也可以不拿). 当小明走到出口时,如果他手中的宝贝恰好是k件,则这些宝贝就可以送给小明. 请你帮小明算一算,在给定的局面下,他有多少种不同的行动方案能获得这k件…
乘风破浪:LeetCode真题_038_Count and Say 一.前言 这一道题目,很类似于小学的问题,但是如果硬是要将输入和结果产生数值上的联系就会产生混乱了,因此我们要打破思维定势. 二.Count and Say 2.1 问题 2.2 分析与解决 这道题最难的其实是理解,因为描述的不尽其意,所以很难理解,其实就是根据最开始的字符串,不断的扩展,输入的N,代表的是经过N次之后的结果,与其中的结果没有任何关系. /** * 题目大意 * n=1时输出字符串1:n=2时,数…
乘风破浪:LeetCode真题_030_Substring with Concatenation of All Words 一.前言 这次我们还是找字符串的索引,不过,需要将另一个字符串列表中的字符串拼接起来,要求全部都拼接并且出现且仅出现一次,然后在字符串中求子串的起始位置. 二.Substring with Concatenation of All Words 2.1 问题 2.2 分析与解决 其实我们仔细想一下,求子串的索引可以使用工具库来解决,重要的是将字符串列表中的字符串…
乘风破浪:LeetCode真题_011_Container With Most Water 一.前言 下面我们继续进行编程练习,可以说对于实际问题的活学活用是非常重要的.比如我们这次的题目,就需要从中找到问题的性质,然后去庖丁解牛. 二.Container With Most Water 2.1 问题理解 2.2 问题分析与解决 题意我们很容易读懂,就是求木桶的最大盛水量,底乘以高就可以了,其中底也非常容易求得,就是高需要取得两者的最小值.最简单的办法就是我们通过两个for循环,暴力的…