摘要: 链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=36题目: 最长公共子序列描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此条件序列中最长的,则 S 称为已知序列的最长公共子序列。输入第一行给出一个整数N(0<N<... 阅读全文
posted @ 2013-05-09 09:18 lysr__tlp 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 链接: http://acm.hdu.edu.cn/showproblem.php?pid=2196题目: ComputerProblem DescriptionA school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer ... 阅读全文
posted @ 2013-05-01 17:11 lysr__tlp 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 题意 补最少的边成强连通图。 缩点后,max{ 入度为0点数, 出度为零点数}即为所求的值 (vector,belong,DFN,LOW) View Code 1 #include<stdio.h> 2 #include<vector> 3 #include<string.h> 4 using namespace std; 5 vector <int> Q[20005],R[20005]; 6 int x,y,Num; 7 bool instack[20005]; //标记在栈里的元素 8 int stack[20005]; //存储当... 阅读全文
posted @ 2013-04-29 21:19 lysr__tlp 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 传统 C++ #include <assert.h> //设定插入点 #include <ctype.h> //字符处理 #include <errno.h> //定义错误码 #include <float.h> //浮点数处理 #include <fstream.h> //文件输入/输出 #include <iomanip.h> //参数化输入/输出 #include <iostream.h> //数据流输入/输出 #include <limits.h> //定义各种数据类型最值常量 #inclu 阅读全文
posted @ 2013-04-07 13:06 lysr__tlp 阅读(184) 评论(0) 推荐(0) 编辑