上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 31 下一页
摘要: 题目DescriptionOne of the more popular activities in San Antonio is to enjoy margaritas in the park along the river know as theRiver Walk. Margaritas may be purchased at many establishments along the River Walk from fancy hotels toJoe’s Taco and Margaritastand. (The problem is not to find out how Joe 阅读全文
posted @ 2013-12-03 19:40 SangS 阅读(321) 评论(0) 推荐(0) 编辑
摘要: Before:1. 研究的需要, 在 google map 上爬取了一些的静态卫星地图图片,每张图片的像素为 256*2562.通过 photshop 将这些地图碎片手动拼成了地图, 地图只是覆盖了学校而已, 还是比较小的3. 我通过手机采集到一些 GPS 的 trace, 希望在这个离线地图上画上这些 GPS 点4. 最初, 我以为地图上的经纬度都是等距分布的, 比如一张图片的顶部纬度是20, 底部纬度为22, 那么图片中间的横线纬度是 21. 实际上, 并非如此, 中间横线的纬度应当是小于 21 的, 想了解具体的原因, 可搜索墨卡托投影5. 好消息是, 经度是等距分布的, 比如图片左边经 阅读全文
posted @ 2013-12-03 15:18 SangS 阅读(4152) 评论(0) 推荐(0) 编辑
摘要: 与 POJ 上那道括号匹配相比, 这道可谓简单思路:堆栈存储符号, 遇到匹配弹出代码:#include #include using namespace std;class Solution {public: bool isValid(string s) { stack record; for(int i = 0; i < s.size(); i ++) { if(record.empty()) { record.push(s[i]); }else{ if((s[i] == '(' && record.top()==')') || (s[i 阅读全文
posted @ 2013-12-03 11:10 SangS 阅读(192) 评论(0) 推荐(0) 编辑
摘要: RMQRMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值,也就是说,RMQ问题是指求区间最值的问题。——百度百科举个例子:在1 0 4 99 8 5这一串数中求第2个数到第5个数的最小值。有什么办法?最简单的莫过于循环一次,时间为O(N).但如果有许多个询问呢?这时就要用到ST算法了。利用动规预处理出每一段的最值,对于每个询问,只要O(1)的时间便能得出答案。动规如下:f[i][j]表示从第i个位置开始的2^j个数中的最小值。转移方程如下:f[i][j 阅读全文
posted @ 2013-12-03 10:08 SangS 阅读(238) 评论(0) 推荐(0) 编辑
摘要: DescriptionAn array of sizen≤ 106is given to you. There is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding window moves rightwards by one position. Following is an example:The array is[13-1- 阅读全文
posted @ 2013-12-03 10:06 SangS 阅读(192) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.InputThe input file may 阅读全文
posted @ 2013-12-02 10:53 SangS 阅读(225) 评论(0) 推荐(0) 编辑
摘要: DescriptionWe give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,ifsis a regular brackets sequence, then (s) and [s] are regular brackets sequences, andifaandbare regular brackets sequences, thenabis a regular brackets sequence. 阅读全文
posted @ 2013-12-01 18:25 SangS 阅读(241) 评论(0) 推荐(0) 编辑
摘要: DescriptionSome of you may have played a game called 'Blocks'. There are n blocks in a row, each box has a color. Here is an example: Gold, Silver, Silver, Silver, Silver, Bronze, Bronze, Bronze, Gold.The corresponding picture will be as shown below:Figure 1If some adjacent boxes are all of 阅读全文
posted @ 2013-12-01 16:31 SangS 阅读(810) 评论(0) 推荐(0) 编辑
摘要: DescriptionBugs Integrated, Inc. is a major manufacturer of advanced memory chips. They are launching production of a new six terabyte Q-RAM chip. Each chip consists of six unit squares arranged in a form of a 2*3 rectangle. The way Q-RAM chips are made is such that one takes a rectangular plate of 阅读全文
posted @ 2013-12-01 11:35 SangS 阅读(424) 评论(0) 推荐(0) 编辑
摘要: Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示它能够攻击到的区域:沿横向左右各两格,沿纵向上下各两格。图上其它白色网格均攻击不到。从图上可见炮兵的攻击范围不受地形的影响。现在,将军们规划如何部署炮兵部队,在防止误伤的前提 阅读全文
posted @ 2013-11-30 20:16 SangS 阅读(261) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 31 下一页