escriptionThenthTriangularnumber,T(n) = 1 + …
+n, is the sum of the firstnintegers. It is the number of points in a triangular
array withnpoints on si...
分类:
其他好文 时间:
2014-05-19 19:50:24
阅读次数:
191
比较经典一个课程学分表C(cno, cname, ccredit)一个学生选课表SC(sno,
cno, grade)select sno from sc,c where sc.cno=c.sno and sc.grade>=60 group by
sno having sum(credit)>=3...
分类:
其他好文 时间:
2014-05-19 17:06:41
阅读次数:
218
Combination Sum IGiven a set of candidate
numbers (C) and a target number (T), find all unique combinations in C where the
candidate numbers sums to T...
分类:
其他好文 时间:
2014-05-19 16:41:14
阅读次数:
269
1 (1)Let $\sed{x_k}_{k=1}^n \subset (0,\pi)$, and
define $$\bex x=\frac{1}{n}\sum_{k=1}^n x_i. \eex$$ Show that $$\bex
\prod_{k=1}^n \frac{\sin x_k}{x...
分类:
其他好文 时间:
2014-05-19 14:46:27
阅读次数:
388
【题目】
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
For example, given array S = {...
分类:
其他好文 时间:
2014-05-18 10:37:57
阅读次数:
269
【题目】
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
Elements in a quadruplet (a,b,c,d) must be in non-descending ord...
分类:
其他好文 时间:
2014-05-18 08:46:04
阅读次数:
227
题目:给定一个数组,以及一个 target 值,target 表示目标和,要求在数组中找到两个数,xi,xj,使得 xi + xj = target。返回值是找到的两个数的下标索引,升序排序。假定至少存在一对解。
分析:对于要处理数组的问题,我们的理想状态都是给定的数组是有序的就好了,在有序后,我们就可以首位各放一个标记。类似于二分查找。
vector twoSum(vector &n...
分类:
其他好文 时间:
2014-05-18 08:04:03
阅读次数:
234
3SumClosest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution....
分类:
其他好文 时间:
2014-05-18 05:57:48
阅读次数:
244
题目一:求1!+2!+…..+n! 的和的后6位,(注意n的范围)
#include
using namespace std;
const int MAX = 1000000;
int getResu(int n)
{
int sum=0;
int temp= 1;
for(int i=1; i <= n; i++)
{
temp *= i;
temp %= MAX;
...
分类:
其他好文 时间:
2014-05-18 03:36:19
阅读次数:
223
【题目】
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c)
The so...
分类:
其他好文 时间:
2014-05-18 03:15:50
阅读次数:
287