You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-28 10:45:34
阅读次数:
225
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-06-26 00:29:49
阅读次数:
168
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal...
分类:
其他好文 时间:
2014-06-25 23:01:44
阅读次数:
227
其实就是容斥原理了代码: 1 uses math; 2 const maxn=55000; 3 var i,n,a,b,c,d,w,tot:longint; 4 ans:int64; 5 sum,mu,p:array[0..maxn] of int64; 6 procedure ge...
分类:
其他好文 时间:
2014-06-25 22:10:01
阅读次数:
299
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:
其他好文 时间:
2014-06-25 22:07:58
阅读次数:
330
PrintEcho print 输出转型$sum=0;$total=(float)$sumIsset() unset()判断一个变量是否存在$echo intval$sum 浮点型Define(“total”,100); 常量一旦定义就不可更改判断句14){Echo’内容’;}?>14){Echo’...
分类:
Web程序 时间:
2014-06-25 21:47:59
阅读次数:
281
题目链接:点击打开链接
我们把 1 / { u(i)*v(i) }拆开-> (1/(u(i)-v(i)) * ( 1/v(i) - 1/u(i) )
若n +1 是素数,则显然(1/(u(i)-v(i)) * ( 1/v(i) - 1/u(i) ) 这样完全相同的式子有 u(i)-v(i) 个
那么就可以把前面系数约掉,那么剩下的式子就是 1/2 - 1/(n+1)
若不是,则...
分类:
其他好文 时间:
2014-06-24 21:36:17
阅读次数:
216
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-06-24 18:56:54
阅读次数:
240
class Solution {public: int maxProfit(vector &prices) { int len = prices.size(); if (len < 1) return 0; int sum = 0; in...
分类:
其他好文 时间:
2014-06-24 11:28:47
阅读次数:
193
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ...
分类:
其他好文 时间:
2014-06-22 10:45:17
阅读次数:
258