码迷,mamicode.com
首页 >  
搜索关键字:k sum    ( 21381个结果
又一次遇到+=操作的隐藏转型问题。
隐藏转型的问题,对于简单的例子,大家都已经知道:short i=1,j=1;short k = i+j ;//编译错误,需要手工转型 。但是 i++是可以的。这里就涉及隐藏转型的问题。今天优化代码,原来的double用float,有一处没有修改,竟然能正确编译:        float sum = 0;        float[] location = point.getLocation();...
分类:其他好文   时间:2014-08-26 13:49:06    阅读次数:155
HDU1003- Max Sum(DP优化入门题目)
动态规划入门题目...
分类:其他好文   时间:2014-08-26 13:43:46    阅读次数:165
poj2193
1 //Accepted 368K 532MS 2 //线性dp 3 //dp[i][j]表示前i位最后一个是j的排列数 4 //dp[i][j]=sum(dp[i-1][h]) h*2 6 #include 7 #include 8 using namespace std; 9...
分类:其他好文   时间:2014-08-26 13:39:56    阅读次数:216
POJ 2159(判断可重集合相等&hash)
POJ 2159 题目归结为判断两个自然数多集(允许有重复元素的集合)a, b是否相等。用快排比较的效率是O(nlgn). 此题中a.b则分别是每个字母个数集。 下面提出一种O(n)的方法供大家参考。 猜想:若 sum(a^i) = sum(b^i),i = 0, 1, 2, 则 a = b。 证明:? 注意 sum(s^0) 是多集s中元素的数目 su...
分类:其他好文   时间:2014-08-26 11:49:56    阅读次数:219
UVA - 1415 Gauss Prime
Description In the late 1700s', Gauss, a famous mathematician, found a special kind of numbers. These integers are all in the form: a + b .The sum and multiplication ofthese integers can be natura...
分类:其他好文   时间:2014-08-26 11:46:25    阅读次数:237
URAL 1068 Sum
用最笨但是最省心的写法…… 1 import java.util.Scanner; 2 3 public class P1068 4 { 5 public static void main(String args[]) 6 { 7 try (Scanner cin ...
分类:其他好文   时间:2014-08-26 02:53:25    阅读次数:155
URAL 1044 Lucky Tickets. Easy!
算是个动态规划,统计和sum[位数][差值]构建个虚拟数组写起来就顺多了 1 import java.util.Scanner; 2 3 public class P1044 4 { 5 private static int save[][] = new int[10][100]; 6 ...
分类:其他好文   时间:2014-08-26 02:53:05    阅读次数:243
CF-85D-Sum of Medians(线段树)
In one well-known algorithm of finding the k-th order statistics we should divide all elements into groups of five consecutive elements and find the median of each five. A median is called the middl...
分类:其他好文   时间:2014-08-25 22:50:55    阅读次数:297
LeetCode: Triangle
LeetCode: TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For exa...
分类:其他好文   时间:2014-08-25 22:48:14    阅读次数:306
LeetCode: Binary Tree Maximum Path Sum
LeetCode: Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example:G...
分类:其他好文   时间:2014-08-25 22:34:54    阅读次数:184
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!