链接看此题前先看一下matrix67大神写的关于十个矩阵的题目中的一个,如下:经典题目8
给定一个有向图,问从A点恰好走k步(允许重复经过边)到达B点的方案数mod
p的值把给定的图转为邻接矩阵,即A(i,j)=1当且仅当存在一条边i->j。令C=A*A,那么C(i,j)=ΣA(i,k)*A(k,j...
分类:
其他好文 时间:
2014-05-20 02:46:43
阅读次数:
249
题目描述Given a number sequence whose length is n, you
can delete at most k numbers in the sequence.After that you are asked to answer
the maximum length ...
分类:
其他好文 时间:
2014-05-19 22:21:32
阅读次数:
304
Subsequence
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8128
Accepted: 3141
Description
A sequence of N positive integers (10 < N < 100 000), each of t...
分类:
其他好文 时间:
2014-05-18 15:26:37
阅读次数:
284
题目:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Clarification:
What constitutes a word?
A sequence of non-spa...
分类:
其他好文 时间:
2014-05-18 04:12:07
阅读次数:
198
Given an unsorted array of integers, find the
length of the longest consecutive elements sequence.For example,Given[100, 4,
200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2014-05-18 01:52:45
阅读次数:
317
控制焦点Focus on Control 的取值:Alternative
fragment(denoted “alt”) 与 if…then…else对应Option fragment (denoted “opt”) 与
Switch对应Parallel fragment (denoted “par...
分类:
其他好文 时间:
2014-05-17 22:05:02
阅读次数:
298
Problem DescriptionA number sequence is defined
as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given
A, B, and n, you are t...
分类:
其他好文 时间:
2014-05-16 00:34:50
阅读次数:
354
【题目】
A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S <
100 000 000) are given. Write a program to find the minimal length of the subse...
分类:
其他好文 时间:
2014-05-15 07:58:17
阅读次数:
329
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
这道题还挺好的,如果你的思路是每次生成一个全排列,然后累计到k次,那么停下来吧,肯定超时了亲。。
微软今年的笔试题里有一道类似的,我之前已经提到过了,是只有0和1的字符串,求第k个排列是什么样子的。这道题比那个要难一些,但是总体的思路是一样的。假设有n个数要组成排列,求第k个排列。像填表一样,从高位往地位,逐个填写。先考虑有n-1个数要组成排列,最多有(n-1)!种情况,当第n个数加入后,第n个...
分类:
其他好文 时间:
2014-05-13 13:42:02
阅读次数:
246