码迷,mamicode.com
首页 >  
搜索关键字:spoj balnum balanced    ( 1777个结果
BZOJ2400: Spoj 839 Optimal Marks
题解:第一问论文题。。。见胡伯涛最小割。考虑第二问。我们发现求完最小割之后直接从s bfs到的点作为1就可以达到最小花费了,但这是为什么呢?因为我们从s bfs到的点一定属于s割,而t点bfs到的点一定属于t割,剩下的点所属的割不确定。那我们不妨认为它们都是t割,这样花费就最少了。代码: 1 #i....
分类:其他好文   时间:2014-12-28 00:24:23    阅读次数:226
online judge
浙江大学 acm在线测试http://acm.zju.edu.cn/onlinejudge/北京大学 acm在线测试http://acm.pku.edu.cn/JudgeOnline/http://www.spoj.pl/
分类:其他好文   时间:2014-12-28 00:19:26    阅读次数:170
Convert Sorted Array to Binary Search Tree
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.题意:给一个升序排好的...
分类:其他好文   时间:2014-12-27 20:23:04    阅读次数:235
LeetCode[Tree]: Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 这个问题比较简单,用递归是个不错的选择,我的C++代码实现如下: class Solution { public: TreeNode *sortedArrayToBST(vecto...
分类:其他好文   时间:2014-12-25 22:09:34    阅读次数:241
[LeetCode]110.Balanced Binary Tree
【题目】 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node n...
分类:其他好文   时间:2014-12-24 16:23:25    阅读次数:200
LeetCode: Convert Sorted Array to Binary Search Tree 解题报告
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.SOLUTION 1:...
分类:其他好文   时间:2014-12-23 13:52:56    阅读次数:200
Prime Generator(spoj)
原题:Prime GeneratorProblem code: PRIME1Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime nu...
分类:其他好文   时间:2014-12-20 16:45:38    阅读次数:179
Life, the Universe, and Everything(spoj)
原题:Your program is to use the brute-force approach in order tofind the Answer to Life, the Universe, and Everything.More precisely... rewrite small nu...
分类:其他好文   时间:2014-12-19 20:41:37    阅读次数:189
素数筛法--SPOJ Problem 2 Prime Generator
质数(prime number)又称素数,除了1和它本身外,不能整除以其他自然数,换句话说就是该数除了1和它本身以外不再有其他的因数;否则称为合数。最小的质数是2。要判断一个整数N是不是质数很简单,看它是否能被2到sqrt(N)之间的整数整除即可。def isPrime(n): if n%2=...
分类:其他好文   时间:2014-12-19 20:31:07    阅读次数:129
【BZOJ】1825. Free tour II(点分治)
http://www.spoj.com/problems/FTOUR2/先前看了一会题解就自己yy出来了。。。对拍过后交tle。。。。。。。。。。。。。。。。。。自己造了下大数据。。。。。。。。tle。。。。。。。。。。。。。。。。。。。。。。。。。what?明早更新吧。。调到吐了。。#includ...
分类:其他好文   时间:2014-12-19 01:50:07    阅读次数:296
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!