很锻炼DP/recursive思路的一道题,个人感觉DP/recursive算是比较难写的题目了。这道题解法的巧妙之处在于巧用-1,并且使用临时存储,节省了很多开支。这道题同时也在Career
Cup上面出现过这道题我两次调试通过,第一次错是因为input{}, output false, expe...
分类:
其他好文 时间:
2014-05-05 22:45:10
阅读次数:
352
Problem
Link:http://oj.leetcode.com/problems/word-ladder/Two typical techniques are
inspected in this problem:Hash Table. One hash set is the words di...
分类:
其他好文 时间:
2014-05-05 22:44:44
阅读次数:
393
Problem E: WeddingUp to thirty couples will
attend a wedding feast, at which they will be seated on either side of a long
table. The bride and groom s...
分类:
其他好文 时间:
2014-05-05 22:10:59
阅读次数:
373
Problem Description
Given an positive integer A (1
For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so the output should be 2.
Another example...
分类:
其他好文 时间:
2014-05-05 13:22:39
阅读次数:
394
Input
t – the number of numbers in list, then t lines follow [t
Each line contains one integer: N [0 N
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
...
分类:
其他好文 时间:
2014-05-04 00:04:09
阅读次数:
376
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets
so as the following conditions hold:
The product of all numbers in the first set is less ...
分类:
其他好文 时间:
2014-05-03 23:51:19
阅读次数:
621
【题目】
B
Age Sort
Input: Standard Input
Output: Standard Output
You are given the ages (in years) of all people of a country with at least 1 year of age. You kn...
分类:
其他好文 时间:
2014-05-03 16:51:42
阅读次数:
427
The game of billiards involves two players knocking 3 balls around
on a green baize table. Well, there is more to it, but for our
purposes this is sufficient.
The game consists of several rounds ...
分类:
其他好文 时间:
2014-05-03 16:15:33
阅读次数:
296
模块“市”的设计与加入
现在重复加入“省”模块的过程,来加入市的模块。
1、建立数据表CityCREATE TABLE [dbo].[City](
[tf_cityId] [nvarchar](4) COLLATE Chinese_PRC_CI_AS NOT NULL,
[tf_provinceId] [nvarchar](2) COLLATE Chinese_PRC_...
分类:
其他好文 时间:
2014-05-03 16:02:29
阅读次数:
293
把一般式子转换成逆波兰式。
这里的都是加括号的,难度降低点。
Example
Input:
3
(a+(b*c))
((a+b)*(z+x))
((a+t)*((b+(a+c))^(c+d)))
Output:
abc*+
ab+zx+*
at+bac++cd+^*
知道其特点就好办:
1 遇到字母一定是可以输出的
2 遇到操作符号就入栈
3 遇到括号')',就出栈...
分类:
其他好文 时间:
2014-05-03 15:35:28
阅读次数:
317