Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.将整数用罗马数字表示。思路分析: {"","I","II","III","IV",".....
分类:
编程语言 时间:
2015-07-28 12:46:42
阅读次数:
164
题目链接:http://poj.org/problem?id=3207思路分析:该问题给出N个点,并给出M条连接这些点的线,需要判断是否这些线不会相交;(1)假设两条线A的端点按照圆圈的顺时针方向依次为A0,A1,同理线B为B0, B1,则可以知道当 A0 线B在外侧,线A在外侧—>线B在内侧,线B...
分类:
其他好文 时间:
2015-07-28 10:15:20
阅读次数:
137
题目:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most k transactions.
Note:
Y...
分类:
编程语言 时间:
2015-07-26 15:56:12
阅读次数:
142
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1235题意: 有N个硬币(N<=18),问能否在每个硬币使用不超过两次的情况下支付正好K的面额。思路 : dfs构造出用这些硬币用前一半能支付的所有费用和后一半能支付的所有费用。之后排序,枚举前一半的每个面值在第二个里面二分寻找即可。(或者用set保存)。代码:(set)#incl...
分类:
其他好文 时间:
2015-07-25 12:20:59
阅读次数:
116
题目https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/
Say you have an array for which the ith element is the price of a
given stock on day i. Design an algorithm to find the maximum...
分类:
其他好文 时间:
2015-07-24 09:22:28
阅读次数:
125
Marriage Match IV
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2470 Accepted Submission(s): 742
Problem Description
Do not si...
分类:
其他好文 时间:
2015-07-23 22:01:06
阅读次数:
162
function/bind1. std::functioni.是一个函数的包装器ii.std::functioniii.这是一个模板实现的函数对象类,它可以包装其它任意的函数对象,而被包装的函数对象具有类型为T1,T2,…,TN的参数,其返回值为R类型iv.function 对象的最大用处在于实现函...
分类:
编程语言 时间:
2015-07-23 06:38:11
阅读次数:
161
188 Best Time to Buy and Sell Stock IV这道题是我目前为止最得意的一道题了 看看自己的运行时间已经超出所有 Python的解法 自己都醉了class Solution: def __init__(self): self.start = 0 ...
分类:
其他好文 时间:
2015-07-21 14:11:50
阅读次数:
122
【012-Integer to Roman(数字转罗马字符)】输入一个数字,将它转成一个罗马数字,输入的数字在[1, 3999]之间。
罗马数字的表示:
个位数举例: (I, 1) (II, 2) (III, 3) (IV, 4) (V, 5) (VI, 6) (VII, 7) (VIII, 8) (IX, 9)
十位数举例:(X, 10) (XI, 11) (XII, 12) (X...
分类:
编程语言 时间:
2015-07-20 09:21:27
阅读次数:
135
之前我们制定了一个很简单的RPC消息 的格式,但没有实现相应的encode和decode方法,下面我们处理掉这个编解码问题。这里我还是简单原则,重点在于晓义嘛。利用python里的两个运算。 str 和eval,实现编解码。...
分类:
其他好文 时间:
2015-07-19 20:14:06
阅读次数:
171