杰拉斯的博客
[ACM_ZJUT_1060]个数最多的余数
杰拉斯 | 时间:2012-04-05, Thu | 19,839 views编程算法
个数最多的余数
Time Limit:1000MS Memory Limit:32768K
Description
输入一些正整数(个数≤10000),计算其模100的余数,输出个数最多的余数。
Sample Input
101 105 1 305 9 901
Sample Output
1
[ACM_NYOJ_37]回文字符串
杰拉斯 | 时间:2012-04-04, Wed | 18,070 views编程算法
回文字符串
时间限制:3000 ms | 内存限制:65535 KB
难度:4
描述
所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba"。当然,我们给你的问题不会再简单到判断一个字符串是不是回文字符串。现在要求你,给你一个字符串,可在任意位置添加字符,最少再添加几个字符,可以使这个字符串成为回文字符串。
输入
第一行给出整数N(0 接下来的N行,每行一个字符串,每个字符串长度不超过1000.
输出
每行输出所需添加的最少字符数
样例输入
1 Ab3bd
样例输出
2
[ACM_ZOJ_1733]Longest Common Subsequence
杰拉斯 | 时间:2012-04-04, Wed | 41,199 views编程算法
Common Subsequence
(最长公共子序列)
Time Limit: 2 Seconds Memory Limit: 65536 KB
Description
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increasing sequence of indices of X such that for all j = 1,2,...,k, xij = zj. For example, Z = is a subsequence of X = with index sequence . Given two sequences X and Y the problem is to find the length of the maximum-length common subsequence of X and Y.
The program input is from a text file. Each data set in the file contains two strings representing the given sequences. The sequences are separated by any number of white spaces. The input data are correct. For each set of data the program prints on the standard output the length of the maximum-length common subsequence from the beginning of a separate line.
[ACM_POJ_2533]Longest Ordered Subsequence
杰拉斯 | 时间:2012-04-03, Tue | 20,349 views编程算法
Longest Ordered Subsequence
(最长有序子序列)
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 21942 Accepted: 9441
Description
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence.
Input
The first line of input file contains the length of sequence N. The second line contains the elements of sequence - N integers in the range from 0 to 10000 each, separated by spaces. 1 <= N <= 1000
Output
Output file must contain a single integer - the length of the longest ordered subsequence of the given sequence.
[ACM_ZJUT_1029]斐波那契数列
杰拉斯 | 时间:2012-04-03, Tue | 17,776 views编程算法
Fibonacci数
Time Limit:1000MS Memory Limit:32768K
Description
有一些整数(≤46),输出以这些整数为序数的第n项fibonacci数。文件中的数据可能上万,但要求运行时间不超过1秒钟。
注:f(0) = 0; f(1) = 1; f(n) = f(n-1) + f(n-2).
Sample Input
5 6 7 8 9 40
Sample Output
5 8 13 21 34 102334155