单点时限:1000ms
内存限制:256MB描述
Given two positive integers N and M, please divide N into several integers A1, A2, …, Ak (k >= 1), so that:
1. 0 < A1 < A2 < … < Ak;
2. A1 + A2 + … + Ak = N;
3. A1, A2, …,...
分类:
其他好文 时间:
2015-08-12 10:18:01
阅读次数:
102
Problem Description
There are m soda
and today is their birthday. The 1-st
soda has prepared n cakes
with size 1,2,…,n.
Now 1-st
soda wants to divide the cakes into m parts
so that the ...
分类:
其他好文 时间:
2015-08-10 22:08:02
阅读次数:
125
Problem description
A convex polygon with n edges can be divided into several triangles by some non-intersect diagonals. We denote d(n) is the number of the different ways to divide the convex ...
分类:
其他好文 时间:
2015-08-08 23:00:19
阅读次数:
179
一、综述
归并排序(Merge sort,台湾译作:合并排序)是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide
and Conquer)的一个非常典型的应用。
算法描述
归并操作的过程如下:
申请空间,使其大小为两个已经排序序列之和,该空间用来存放合并后的序列设定两个指针,最初位置分别为两个已经排序序列的起始位置比较两个...
分类:
编程语言 时间:
2015-08-08 16:40:13
阅读次数:
114
029 Divide Two Integersclass Solution: # @param {integer} dividend # @param {integer} divisor # @return {integer} def divide(self, dividen...
分类:
其他好文 时间:
2015-08-08 16:15:09
阅读次数:
99
class Solution {public: int divide(int dividend, int divisor) { bool flag=((dividend >0) ^ (divisor>0)); cout0); cout0); ...
分类:
其他好文 时间:
2015-08-03 16:23:10
阅读次数:
113
慢慢积累 先来排序 快速排序使用分治法(Divide?and?conquer)策略来把一个串行(list)分为两个子串行(sub-lists)。 算法步骤: 1?从数列中挑出一个元素,称为?“基准”(pivot), 2?重新排序数列,所有...
分类:
编程语言 时间:
2015-08-02 21:47:31
阅读次数:
259
Problem Definition:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Solution:就是要用加减和位操作之类...
分类:
其他好文 时间:
2015-08-01 21:58:41
阅读次数:
98
087 Scramble String这道题是divide and conquer。 使用sorted可以快速判断 要不然会超时class Solution: # @param {string} s1 # @param {string} s2 # @return {boolean}...
分类:
其他好文 时间:
2015-08-01 12:52:49
阅读次数:
146
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: Using binary search to divide the sorted arr...
分类:
其他好文 时间:
2015-07-31 12:19:02
阅读次数:
102