2016年3月16日
摘要: Human Gene Functions 题意: LCS: 设dp[i][j]为前i,j的最长公共序列长度; dp[i][j] = dp[i-1][j-1]+1;(a[i] == b[j]) dp[i][j] = max(dp[i][j-1],dp[i-1][j]); 边界:dp[0][j] = 0 阅读全文
posted @ 2016-03-16 22:47 yoyo_sincerely 阅读(238) 评论(0) 推荐(0) 编辑
  2016年3月11日
摘要: 详细理解看这里:http://kb.cnblogs.com/page/176818/ 或者这里:http://blog.csdn.net/yutianzuijin/article/details/11954939 next[]数组的意义是“除自身外的最大重复子串”。 next数组计算: 理解了kmp 阅读全文
posted @ 2016-03-11 09:42 yoyo_sincerely 阅读(725) 评论(0) 推荐(0) 编辑
  2016年3月9日
摘要: 题目:Report 题意:有两种操作: 1)t = 1,前r个数字按升序排列; 2)t = 2,前r个数字按降序排列; 求执行m次操作后的排列顺序。 #include <iostream> #include <algorithm> #include <stdlib.h> #include <time 阅读全文
posted @ 2016-03-09 20:20 yoyo_sincerely 阅读(345) 评论(0) 推荐(0) 编辑
  2016年3月8日
摘要: 竟然从没写过链表!!!struct node { int num; node *next; }; node *head, *p, *q; void Init(){ head = new node(); q = head; } void Insert(int x){ //尾插x; p = new node(); ... 阅读全文
posted @ 2016-03-08 11:27 yoyo_sincerely 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 连接:Print Check 题意:n行m列的矩阵,有k次涂色,每一涂一行或者一列,求最后的涂色结果。 从数据的大小看,暴力肯定要TLE; 问题是如何存储数据。 首先:我们只要最后的涂色结果。 其次:没有必要用for每个数据涂一遍。 所以如果能一次直接涂一行就可以了; #include <iostr 阅读全文
posted @ 2016-03-08 11:14 yoyo_sincerely 阅读(362) 评论(0) 推荐(0) 编辑
  2016年3月4日
摘要: 题意:有N堆石子,现要将石子有序的合并成一堆,规定如下:每次只能移动相邻的2堆石子合并,合并花费为新合成的一堆石子的数量。求将这N堆石子合并成一堆的总花费最小(或最大)。 dp[i][j]为从i到j的最小代价;sum为i到j的和;k用于分割dp[i][j]; 动态转移方程为:dp[i][j]=min 阅读全文
posted @ 2016-03-04 17:41 yoyo_sincerely 阅读(290) 评论(0) 推荐(0) 编辑
  2016年3月2日
摘要: 线段树(英语:Segment Tree)是一种二叉搜索树,它将一个区间划分成一些单元区间,每个单元区间对应线段树中的一个叶结点。 对于线段树中的每一个非叶子节点[a,b],它的左子树表示的区间为[a,(a+b)/2],右子树表示的区间为[(a+b)/2+1,b]。因此线段树是平衡二叉树。叶节点数目为 阅读全文
posted @ 2016-03-02 21:04 yoyo_sincerely 阅读(622) 评论(0) 推荐(0) 编辑
  2016年2月20日
摘要: 1 #include<iostream> 2 #include<string> 3 #include <limits> 4 using namespace std; 5 6 int main() 7 { 8 cout << "type: \t\t" << "************size***** 阅读全文
posted @ 2016-02-20 21:39 yoyo_sincerely 阅读(313) 评论(0) 推荐(0) 编辑
  2016年2月15日
摘要: 普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点,且其所有边的权值之和亦为最小。该算法于1930年由捷克数学家沃伊捷赫·亚尔尼克发现;并在1957年由美国计算机科学家罗伯特·普里姆独立发现;1959年, 阅读全文
posted @ 2016-02-15 21:46 yoyo_sincerely 阅读(5504) 评论(0) 推荐(0) 编辑
  2016年2月14日
摘要: Sum of Different Primes Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 3360 Accepted: 2092 Description A positive integer may be expressed 阅读全文
posted @ 2016-02-14 22:05 yoyo_sincerely 阅读(328) 评论(0) 推荐(0) 编辑
摘要: To the Max Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 44765 Accepted: 23700 Description Given a two-dimensional array of positive and 阅读全文
posted @ 2016-02-14 22:03 yoyo_sincerely 阅读(837) 评论(0) 推荐(0) 编辑
摘要: Marks Distribution Time limit: 3.000 seconds In an examination one student appeared in N subjects and has got total T marks. He has passed in all the  阅读全文
posted @ 2016-02-14 21:04 yoyo_sincerely 阅读(558) 评论(0) 推荐(0) 编辑
  2016年1月28日
摘要: 变量定义 输出方式 gcc(mingw32) g++(mingw32) gcc(linux i386) g++(linux i386) MicrosoftVisual C++ 6.0 long long "%lld" 错误 错误 正确 正确 无法编译 long long "%I64d" 正确 正确 阅读全文
posted @ 2016-01-28 18:27 yoyo_sincerely 阅读(897) 评论(0) 推荐(0) 编辑
  2016年1月24日
摘要: 用python如何实现一个站内搜索引擎? 先想想搜索引擎的工作流程: 1、网页搜集。用深度或者广度优先的方法搜索某个网站,保存下所有的网页,对于网页的维护采用定期搜集和增量搜集的方式。 2、建立索引库。首先,过滤掉重复的网页,虽然他们有不同的URL;然后,提取出网页的正文;最后,对正文切词,建立索引 阅读全文
posted @ 2016-01-24 09:51 yoyo_sincerely 阅读(643) 评论(0) 推荐(0) 编辑
  2016年1月22日
摘要: 题目描述: 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格隔开。N为物品的数量,W为背包的容量。(1 <= N <= 100,1 阅读全文
posted @ 2016-01-22 23:22 yoyo_sincerely 阅读(293) 评论(0) 推荐(0) 编辑
  2016年1月9日
摘要: Recently one of my friend Tarik became a member of the food committee of an ACM regional competition. He has been given m distinguishable boxes, he ha 阅读全文
posted @ 2016-01-09 09:06 yoyo_sincerely 阅读(405) 评论(0) 推荐(0) 编辑
  2016年1月1日
摘要: History Grading Background Many problems in Computer Science involve maximizing some measure according to constraints. Consider a history exam in whic 阅读全文
posted @ 2016-01-01 23:35 yoyo_sincerely 阅读(255) 评论(0) 推荐(0) 编辑
摘要: Communication System Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 25653 Accepted: 9147 Description We have received an order from Pizoor 阅读全文
posted @ 2016-01-01 18:54 yoyo_sincerely 阅读(201) 评论(0) 推荐(0) 编辑
  2015年12月30日
摘要: 学C++的时候,这几个输入函数弄的有点迷糊;这里做个小结,为了自己复习,也希望对后来者能有所帮助,如果有差错的地方还请各位多多指教(本文所有程序均通过VC 6.0运行) 1、cin 2、cin.get() 3、cin.getline() 4、getline() 5、gets() 6、getchar( 阅读全文
posted @ 2015-12-30 22:19 yoyo_sincerely 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Dollars New Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5c coins. Write a program that will determine 阅读全文
posted @ 2015-12-30 21:19 yoyo_sincerely 阅读(394) 评论(0) 推荐(0) 编辑
摘要: Description As you may know from the comic “Asterix and the Chieftain’s Shield”, Gergovia consists of one street, and every inhabitant of the city is 阅读全文
posted @ 2015-12-30 08:53 yoyo_sincerely 阅读(395) 评论(0) 推荐(0) 编辑
  2015年12月17日
摘要: Tian Ji -- The Horse Racing Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 12490 Accepted: 3858 Description Here is a famous story in Chin 阅读全文
posted @ 2015-12-17 20:05 yoyo_sincerely 阅读(658) 评论(0) 推荐(0) 编辑
摘要: Pass-MurailleTime Limit: 2 Seconds Memory Limit: 65536 KB In modern day magic shows, passing through walls is very popular in which a magician perform 阅读全文
posted @ 2015-12-17 15:29 yoyo_sincerely 阅读(347) 评论(0) 推荐(0) 编辑
  2015年12月16日
摘要: Description Input Output Sample Input Sample Output 阅读全文
posted @ 2015-12-16 22:04 yoyo_sincerely 阅读(248) 评论(0) 推荐(0) 编辑
  2015年12月8日
摘要: Pie Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13564 Accepted: 4650 Special Judge Description My birthday is coming up and traditional 阅读全文
posted @ 2015-12-08 17:23 yoyo_sincerely 阅读(370) 评论(0) 推荐(0) 编辑
摘要: 二分查找 二分查找又称折半查找,优点是比较次数少,查找速度快,平均性能好;其缺点是要求待查表为有序表,且插入删除困难。因此,折半查找方法适用于不经常变动而查找频繁的有序列表。首先,假设表中元素是按升序排列,将表中间位置记录的关键字与查找关键字比较,如果两者相等,则查找成功;否则利用中间位置记录将表分 阅读全文
posted @ 2015-12-08 16:24 yoyo_sincerely 阅读(338) 评论(0) 推荐(0) 编辑
摘要: Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 21613 Accepted: 11837 Description Some positive integers c 阅读全文
posted @ 2015-12-08 08:50 yoyo_sincerely 阅读(501) 评论(0) 推荐(0) 编辑
  2015年12月6日
摘要: Goldbach's Conjecture Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41582 Accepted: 15923 Description In 1742, Christian Goldbach, a Germ 阅读全文
posted @ 2015-12-06 22:47 yoyo_sincerely 阅读(352) 评论(0) 推荐(0) 编辑
  2015年12月5日
摘要: ZYB's Premutation Accepts: 220 Submissions: 983 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) 问题描述ZYBZYBZYB有一个... 阅读全文
posted @ 2015-12-05 22:08 yoyo_sincerely 阅读(213) 评论(0) 推荐(0) 编辑
摘要: ZYB's Game Accepts: 672 Submissions: 1207 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem DescriptionZYBZY... 阅读全文
posted @ 2015-12-05 22:01 yoyo_sincerely 阅读(215) 评论(0) 推荐(0) 编辑