码迷,mamicode.com
首页 >  
搜索关键字:minimum sum    ( 24123个结果)
Large sum
聪明的办法是想:求前10位,那只要前8位加起来,进2位就OK。本的办法,就是真的加起来,截前面10位。如我。numList = str.split()sum = 0for i in range(0,len(numList)): sum += int(numList[i][0:50]) p...
分类:其他好文   时间:2014-05-09 23:16:32    阅读次数:350
USACO/fence8 迭代加深搜索+剪枝
题目链接 迭代加深搜索思想。 枚举答案K,考虑到能否切出K个木头,那么我们当然选最小的K个来切。 1、对于原材料,我们是首选最大的还是最小的?显然,首选大的能够更容易切出,也更容易得到答案。 2、对于目标木头,我们是优先得到最大的还是最小的?显然,由于K个木头我们都要得到,那么当然先把最大的(最难得到的)先得到,这种搜索策略更优。 3、假设总原材料为all,前K个木头总和为sum,那...
分类:其他好文   时间:2014-05-09 21:07:28    阅读次数:305
Summation of primes
是我算法不对,还是笔记本CPU太差?我优化了两次,还是花了三四个小时来得到结果。在输出上加1就是最终结果。The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two mil...
分类:其他好文   时间:2014-05-09 16:20:08    阅读次数:295
分词研究中的最小描述长度(Minimum description length)方法
a b ab a ba          MDL(minimum description length,最小描述长度) 原理是 Rissane 在研究通用编码时提出的。其基本原理是对于一组给定的实例数据 D , 如果要对其进行保存 ,为了节省存储空间, 一般采用某种模型对其进行编码压缩,然后再保存压缩后的数据。同时, 为了以后正确恢复这些实例数据,将所用的模型也保存起来。所以需要保存的数据长度(...
分类:其他好文   时间:2014-05-09 15:03:18    阅读次数:415
Leetcode | Path Sum I && II
Path Sum IGiven 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 gi...
分类:其他好文   时间:2014-05-09 13:21:59    阅读次数:320
hust 1009 Sum the K-th
题目描述N integers are arranged on a circle clockwise. Given two integers M and K. For each position, you should take M continuous integers on the left an...
分类:其他好文   时间:2014-05-09 10:30:49    阅读次数:350
Leetcode | 3Sum
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 ...
分类:其他好文   时间:2014-05-09 10:27:29    阅读次数:449
bzoj 1010,1011
1011:#include #include #include #include #include using namespace std;const int maxN = 100001;const double eps = 1e-7;int n;double m[maxN],sum[maxN];d...
分类:其他好文   时间:2014-05-09 08:36:06    阅读次数:303
杭电oj 1001
#includeusing namespace std;int main(){ int n = 0, sum; while (cin>>n) { sum = 0; // 这里要清零 for (int i =0; i <= n; i++) {...
分类:其他好文   时间:2014-05-09 05:38:17    阅读次数:241
HDU - 3415 Max Sum of Max-K-sub-sequence
题意:求长度不超过K的最大的连续序列的和 思路:采用单调队列,我们要求的是Max{sum[i]-sum[j]}(i-j#include #include #include #include using namespace std; const int MAXN = 1000005; const int INF = 0x3f3f3f3f; int n,k; int arr[MAXN],s...
分类:其他好文   时间:2014-05-09 01:57:07    阅读次数:264
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!