uva 1556 - Disk Tree(特里)】的更多相关文章

题目连接:uva 1556 - Disk Tree 题目大意:给出N个文件夹关系,然后依照字典序输出整个文件文件夹. 解题思路:以每一个文件夹名作为字符建立一个字典树就可以,每一个节点的关系能够用map优化. #include <cstdio> #include <cstring> #include <map> #include <string> #include <iostream> #include <algorithm> usi…
Disk Tree Time limit: 2.0 secondMemory limit: 64 MB Hacker Bill has accidentally lost all the information from his workstation's hard drive and he has no backup copies of its contents. He does not regret for the loss of the files themselves, but for…
Tree Summing Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8132   Accepted: 1949 Description LISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, w…
UVA 11922 题意: 有n个数1~n 操作a,b表示取出第a~b个数,翻转后添加到数列的尾部 输入n,m 输入m条指令a,b 输出最终的序列 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define Key_Value ch[ch[root][1]][0] ; int n,m; ],root,tot1; void Update_Rev(int r){…
转载请注明出处:http://blog.csdn.net/a1dark 分析:查了一下这题.发现网上没有什么关于这道题的解题报告.其实题目意思挺好懂的.就是给你一些文件的目录结构.然后让你把它们组合在一起.然后按照目录结构输出.注意是字典序.这道题是一个模拟.主要是对结构体和指针的掌握.使用嵌套结构体模拟文件的同级和子级文件.然后进行读取.插入.查询等操作.代码如下(0ms): #include<stdio.h> #include<string.h> struct node{ no…
1067 破题啊  写完发现理解错题意了 子目录下会有跟之前重名的 把输入的字符串存下来 排下序 然后依次找跟上面有没有重的 #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<map> #include<string> #include<vector> usi…
文件可以重名.先按字典序将路径排序,再过滤掉公共前缀.其中的问题是'\'的ASCII比[A-Z0-9]大,将它替换为空格.否则字典序有问题. /* 1504 */ #include <iostream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include &l…
题目 题目     分析 莫名A了     代码 #include <bits/stdc++.h> using namespace std; string s1,s2; void build(int l1,int r1,int l2,int r2) { int root=l1,p=l2; if(l1>r1) return; while(s2[p]!=s1[root] && p<=r2) p++; int cnt=p-l2; build(l1+1,l1+cnt,l2,…
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4922 题意是给定一颗森林,然后每次都可以删除一条边,或者询问某两个点是否连通. 如果顺着做是不行的.因为并查集路径压缩了,是删不了边的,(据说不路径压缩能AC,) 所以考虑逆向操作.首先不能把已经删除了的边加进去森林里面,先处理出最终状态,然后倒着模拟,就能把删边操作等价于变…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 可以先确定当前这棵子树的dfs序的范围. 然后第一个元素肯定是这棵子树的根节点. 那么只要在这棵子树的范围里面枚举节点. 看看有没有下一个bfs序的节点即可. 如果有的话,那么就说明这个根节点有多个子树. 则加入到它的儿子里面去. 然后确定他的每一个儿子的子树的dfs序的范围. 一直往下递归就好. 用bfs模拟,这样可以保证每次进入某个节点的时候,bfs序的下一个节点就是这个子树的第一个儿子节点. [代码] /* 1.Shoud…