Problem Description有一个长度为n(nint main(){ int m,n,i; while(scanf("%d%d",&n,&m)!=EOF) { int sum=0,k=0,j=0; for(i=1;i<=n;i++)//不能是for(i=...
分类:
其他好文 时间:
2014-07-31 23:31:00
阅读次数:
163
链接这题其实与几何没太大关系,还不错的题目。参考吴永辉的算法设计书。用lefi、rigi分别表示正方形在x轴上的投影。为了避免用小数,把边长都扩大sqrt(2)倍,这样lef1 = 0,rig1 = 2*a1;lefi = max{rigj-abs(ai-aj)}rigi = lefi+2*ai;求...
分类:
其他好文 时间:
2014-07-31 23:30:20
阅读次数:
239
Divide SumTime Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem Descriptionlong long ans = 0;for(int i = 1;...
分类:
其他好文 时间:
2014-07-31 23:24:50
阅读次数:
236
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give...
分类:
其他好文 时间:
2014-07-31 23:18:10
阅读次数:
227
Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tr...
分类:
其他好文 时间:
2014-07-31 23:17:10
阅读次数:
175
1,在SQL中主要提供了5种分组函数,分别是COUNT(),AVG(),SUM(),MIN(),MAX()函数。
2,使用GROUP BY字句可以对数据进行分组操作,而使用HAVING字句可以对分组之后的数据进行再次过滤。
3,在分组时可以同时制定多个分组字段。
4,分组操作不仅可以用于实体表,也可以针对查询的临时表进行分组。
5,分组函数允许嵌套,但是嵌套...
分类:
其他好文 时间:
2014-07-31 21:01:57
阅读次数:
224
Problem H
{sum+=i++} to Reach N
Input: standard input
Output: standard output
Memory Limit: 32 MB
All the positive numbers can be expressed as a sum of one, two or more consecutive positive i...
分类:
其他好文 时间:
2014-07-31 20:58:37
阅读次数:
199
uva 10290 {Sum+=i++} to Reach N (数论-整数和素数)
题目大意:
问一个数n用连续的几个数相加表示的方案数。
解题思路:
假设首项为a,有m项,则 (a+a+m-1)*m=2*n,所以为奇数*偶数的结果,只需要算出2*n用奇数表示的方法数即可。...
分类:
其他好文 时间:
2014-07-31 20:49:07
阅读次数:
179
01背包问题:
有一个体积为V的背包,有n件物品,每件物品的体积,价值分别为w[i],p[i];要从n件物品中选些放入背包中,使背包里物品的总价值最大。
动态方程:c[i][j]=max(c[i-1][j],c[i-1][j-w[i]]+p[i]).
有关动态方程方面的代码:
for (int i = 1; i <= n; i++) {
for (int j = 1; j ...
分类:
其他好文 时间:
2014-07-31 20:47:57
阅读次数:
220
下载: Eclipse: http://www.eclipse.org/downloads/ (本人用的Ubuntu,直接在SoftWare Center中下载的) (选择适合你系统的相应版本,支持windows,linux,max等) PHPeclipse插件: http://so...
分类:
Web程序 时间:
2014-07-31 20:37:37
阅读次数:
234