Humble Numbers
题目描述
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the fi...
分类:
其他好文 时间:
2014-05-15 01:36:22
阅读次数:
230
Integers1, 2, 3,...,nare placed on a circle in
the increasing order as in the following figure. We want to construct a sequence
from these numbers on ...
分类:
其他好文 时间:
2014-05-14 02:54:10
阅读次数:
354
题目来源:POJ 2478 Farey Sequence
题意:输入n 求 phi(2)+phi(3)+phi(4)+...+phi(n)
思路:用类似筛法的方式计算phi(1), phi(2), ..., phi(n) 再求前缀和
#include
#include
#include
//欧拉phi函数
const int maxn = 1000010;
typedef long...
分类:
其他好文 时间:
2014-05-14 01:05:22
阅读次数:
323
DNA Sorting
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 80359
Accepted: 32327
Description
One measure of ``unsortedness'' in a sequence is the number of ...
分类:
其他好文 时间:
2014-05-13 23:34:18
阅读次数:
303
Gao The SequenceTime Limit:2 Seconds Memory
Limit:65536 KBYou are given a sequence of integers,A1,A2,...,An. And you are
allowed a manipulation on the...
分类:
其他好文 时间:
2014-05-13 19:49:14
阅读次数:
277
Cut the Sequence
Time Limit: 2000MS
Memory Limit: 131072K
Total Submissions: 8764
Accepted: 2576
Description
Given an integer sequence { an } of length N, you are to ...
分类:
其他好文 时间:
2014-05-13 16:04:29
阅读次数:
267
You are given a sequence of integers, A1,A2,...,An. And you are allowed a manipulation on the sequence to transform the origin sequence into another sequence B1,B2,...,Bn(Maybe the two sequences are s...
分类:
其他好文 时间:
2014-05-13 13:45:10
阅读次数:
327
这道题还挺好的,如果你的思路是每次生成一个全排列,然后累计到k次,那么停下来吧,肯定超时了亲。。
微软今年的笔试题里有一道类似的,我之前已经提到过了,是只有0和1的字符串,求第k个排列是什么样子的。这道题比那个要难一些,但是总体的思路是一样的。假设有n个数要组成排列,求第k个排列。像填表一样,从高位往地位,逐个填写。先考虑有n-1个数要组成排列,最多有(n-1)!种情况,当第n个数加入后,第n个...
分类:
其他好文 时间:
2014-05-13 13:42:02
阅读次数:
246
Max Sum of Max-K-sub-sequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5690 Accepted Submission(s): 2059
Problem Description
...
分类:
其他好文 时间:
2014-05-13 11:38:49
阅读次数:
256
Given an array, for example, 246135, an inversion pair is the pair whose first value is larger than its second value according to the sequence from left to right, (2,1) (4,1) (4,3) (6,1) (6,3) (6,5)....
分类:
其他好文 时间:
2014-05-13 08:03:58
阅读次数:
338