题目链接:http://acm.acmcoder.com/showproblem.php?pid=2594题意:求最长的串 同时是s1的前缀又是s2的后缀。输出子串和长度。思路:kmp代码:#include
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-06-05 19:53:15
阅读次数:
152
题目链接:http://acm.acmcoder.com/showproblem.php?pid=1025题意:本求最长公共子序列,但数据太多。转化为求最长不下降子序列。太NB了。复杂度n*log(n).解法:dp+二分代码:#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-06-05 17:31:32
阅读次数:
116
Problem Description
Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 =...
分类:
其他好文 时间:
2015-05-26 21:32:01
阅读次数:
114
Problem Description
A 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 to calculate the value of f(n).
Input
The i...
分类:
其他好文 时间:
2015-05-26 21:31:08
阅读次数:
131
Problem Description
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.
Input
The first line of the input contains an integer T(1
Output
F...
分类:
其他好文 时间:
2015-05-26 18:47:18
阅读次数:
148
PS: 开始ACM的受虐!site:http://acm.acmcoder.com/listproblem.php一、1000import java.util.Scanner;public class Main { public static void main(String args[]) { ....
分类:
其他好文 时间:
2015-05-13 21:22:06
阅读次数:
165
题目:A 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 to calculate the ...
分类:
其他好文 时间:
2015-05-04 13:35:13
阅读次数:
111
题目链接:http://acm.acmcoder.com/showproblem.php?pid=1535题意:有向图,求源点到各个点最短路径和+各个点到源点最短路径和。spfa求单源最短路径,求各个点到源点最短路径翻转边。#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-04-18 16:13:50
阅读次数:
160