DescriptionYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has e...
分类:
其他好文 时间:
2014-07-27 22:31:39
阅读次数:
809
用set构造,优先队列和堆也可以
/*
ID:kevin_s1
PROG:humble
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#defi...
分类:
其他好文 时间:
2014-07-27 11:22:12
阅读次数:
141
定理:一个正整数 n 可以用素因子唯一表示为 p1^r1 * p2^r2 * ...
pk^rk (其中 pi 为素数) , 那么这个数的因子的个数就是,(r1+1)*(r2+1)*...*(rk+1).
理解:为什么是加1之后再相乘,因为一个数的的因子数至少为1和他自身,但因为r1,r2。。可以为0,所以因子的个数为(r1+1)。。。
拓展一下:
定理1: 一个正整数 n 可以用素...
分类:
其他好文 时间:
2014-07-26 15:32:46
阅读次数:
194
Problem Description:
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers
sums to T.
Each number in C may only b...
分类:
其他好文 时间:
2014-07-26 15:24:02
阅读次数:
252
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 #includeintnext[10005];ints[1000005],p[10005];intn,m;void...
分类:
其他好文 时间:
2014-07-26 13:46:34
阅读次数:
297
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N...
分类:
其他好文 时间:
2014-07-26 01:42:16
阅读次数:
263
Given a collection of numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,...
分类:
其他好文 时间:
2014-07-26 01:38:56
阅读次数:
214
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-26 00:23:26
阅读次数:
242
Time Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionGiven a list of phone numbers, determine if it is consistent ...
分类:
其他好文 时间:
2014-07-26 00:00:26
阅读次数:
480
Comparison-based sorting takes O(nlgn), so hashset is a good idea. After keeping records of all numbers in the hashset, you start checking each number...
分类:
其他好文 时间:
2014-07-25 03:40:54
阅读次数:
305