`
Coco_young
  • 浏览: 120348 次
  • 性别: Icon_minigender_1
  • 来自: 湖南长沙
社区版块
存档分类
最新评论
文章列表
题目链接: http://poj.org/problem?id=1035 思路是,拿每个带检测字符串和整个字典里的字进行比较,如果有一样的即为correct,如果没有一样的分三种情况: 1.长度相同. 2.带检测字长度比字典里的字少1 3.带检测字长度比字典里的字多1 长度相同时检查不同字符的个数(为1时即可以替换),长度不同时拿较短的字去匹配较长的字,较短字每个字符在较长字中的位置存放在一个数组里,匹配完成后,扫描数组看是否为递增的,并且每一个字符都在较长字中出现。 #include<stdio.h> #include<string.h> #defi ...
Splay tree 伸展树 1.基本思想:把本次访问的结点通过一系列的旋转操作,变换为根结点,同时要保持树为二叉查找树(BST)。 2.旋转操作:Zig,Zag.(代码注释中有说明) 3.核心操作:Splay(伸展). 4.5个基本操作: Find(x,&Spt); //查找操作,在Spt中查找值为x的元素,然后把x所在的结点变为Splay tree的根结点 Insert(x,&Spt);//在spt中插入值为x的结点,并把x所在的结点变为Splay tree的根结点 Delete(x,&Spt);//在spt中删除值为x的结点 Join(&s1 ...
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1272 并查集:用来查找元素所在的集合和合并2个不同的集合,如果用上启发式合并和路径压缩的话,能够进一步优化其效率。一般用森林表示法,即同一个集合的元素属于一颗树,其根节点为该集合的代表元素。 启发式合并:即把深度小得树合并到深度大的树上去。 路径压缩:每次查找完一个元素,都把该查找路径上得元素的父指针指向该集合的代表元素。 #include<iostream> using namespace std; const int SIZE = 100010; int p[S ...
http://acm.hdu.edu.cn/showproblem.php?pid=2544 大水题一枚,仅以练手。 Dijkstra: #include<iostream> using namespace std; #define SIZE 200 #define INF 0xfffffff #define MIN(a,b) a>b?b:a int G[SIZE][SIZE]; int d[SIZE]; int vis[SIZE]; int N,M; int minV() { int i,v; for(i=0;i<N;i++) ...
Emag eht htiw Em Pleh Time Limit: 1000MS  Memory Limit: 65536K Total Submissions: 1646  Accepted: 1127 Description This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input. Input according to output of problem ...
问题来源:http://poj.org/problem?id=2996 Help Me with the Game Time Limit: 1000MS  Memory Limit: 65536K Total Submissions: 2084  Accepted: 1352 Description Your task is to read a picture of a chessboard position and print it in the chess notation. Input The input consists of an ASCII-art picture of a ...
问题来源:http://poj.org/problem?id=1573 Robot Motion Time Limit: 1000MS  Memory Limit: 10000K Total Submissions: 7083  Accepted: 3402 Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. Th ...
问题连接  http://poj.org/problem?id=2632 Crashing Robots Time Limit: 1000MS  Memory Limit: 65536K Total Submissions: 4687  Accepted: 2054 Description In a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without c ...
Parencodings Time Limit: 1000MS  Memory Limit: 10000K Total Submissions: 13268  Accepted: 7886 Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before ...
Y2K Accounting Bug Time Limit: 1000MS  Memory Limit: 65536K Total Submissions: 5785  Accepted: 2796 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc. posted ...
序言:学而不总结,等于没学,特别是我以后可能没有很多时间花在这边了(想专心搞ACM),所以打算以后没学一个新的知识点,必须当天理解完,然后写出总结,不废话了,开始今天的总结 自己回寝室后想了想,总结了几点: 1.系统架构问题:程序应尽量写成“低耦合,高内聚”。 (名词解释和理解: 耦合:不同的模块拼装到一起,产生相互依赖的关系。 高耦合:不同模块之间连接点很多,造成错综复杂的连接关系,修改程序时牵一发则动全身。 低耦合:模块层次化,我觉得理想的效果是,每一层的模块只与它上一层和下一层的模块进行耦合,同层之间的模块是没有交互的。 ) 2.类的四大基本关系: a.关联关系:如A类调用B类。 ...
前段时间写了个自定义通信协议的聊天室(即用\r\n标记字符串,作为一句话),总感觉自己弄的那个协议实现虽然简单,但是拓展性就太差了,只适合于发送聊天的内容,难以包含更多的信息。基于上述几点,于是就开始接触Xmpp ...
  前几天把多人聊天室写完了(也算是照本宣科吧),今天一回想整个多人聊天室的代码,发现沉淀下来的东西并不多,所以觉得得好好总结下!   首先可以分析一下下,多人聊天室是如何进行通信的 ,用户通过客户端把消息 ...
前段时间悲剧的生病了,所以通信阶段的学习也就停了下来,这段时间身体见好,所以在家看了看书。虽然生病前已经写好过一个多线程服务器,但是来不及总结,整体结构也相当混乱,所以在此重新写了一遍,也算是复习一下 ...
问题描述: 输入整数N,按照字典序从小到大打印出1-N的去所有排列。两个序列的字典序大小关系等价于从头开始第一个不相同处的大小关系,(例如(1,2,3)<(3,2,1)),N=3时,输出结果是:(1,2,3)(1,3,2)(2,1,3)(2,3,1)(3,1,2)(3,2,1).   算 ...
Global site tag (gtag.js) - Google Analytics