06 2018 档案

摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 int n; 10 const int maxn=1e3+2; 11 char str[maxn]; 12 string rel; 13 void handle(){ 14 int l... 阅读全文
posted @ 2018-06-22 21:44 shulin15 阅读(258) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include #include using namespace std; int n; string cmd; int now=0; struct node{ int attack; int health; node(int _attack,int _health):attac... 阅读全文
posted @ 2018-06-22 19:58 shulin15 阅读(489) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include using namespace std; const int maxn=1e2+2; char str[maxn]; void line(int l,int r){ int i=l; while(str[i]=='#'||str[i]=='*'||str[i]==' ') i++; ... 阅读全文
posted @ 2018-06-22 17:43 shulin15 阅读(277) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include using namespace std; int n,m; const int maxn=82; char str[maxn]; bool flag; map mp; string handle(string fa){ int len=strlen(str); len--... 阅读全文
posted @ 2018-06-22 17:42 shulin15 阅读(434) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 int n,m; 11 const int maxn=1e2+2; 12 string rule[maxn],value[max... 阅读全文
posted @ 2018-06-20 14:27 shulin15 阅读(842) 评论(0) 推荐(0) 编辑
摘要:http://hihocoder.com/problemset/problem/1369?sid=1328132 参考 https://blog.csdn.net/a1799342217/article/details/73195243 https://blog.csdn.net/a51978118 阅读全文
posted @ 2018-06-19 20:41 shulin15 阅读(346) 评论(0) 推荐(0) 编辑
摘要:【AC】 1 #include<iostream> 2 #include<math.h> 3 #include<cstring> 4 5 using namespace std; 6 7 typedef long long LL; 8 9 int N,M; 10 int type,l,r,v; 11 阅读全文
posted @ 2018-06-19 12:40 shulin15 阅读(270) 评论(0) 推荐(0) 编辑
摘要:【60分】 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<string> 5 #include<cmath> 6 #include<algorithm> 7 #include<queue> 8 #incl 阅读全文
posted @ 2018-06-19 12:38 shulin15 阅读(291) 评论(0) 推荐(0) 编辑
摘要:【思路】 dp[i][j]表示前i个数为第j种状态,考虑6种状态 0: 出现且仅出现 2 1: 出现且仅出现 2 0 2: 出现且仅出现 2 3 3: 出现且仅出现 2 0 1 4: 出现且仅出现 2 0 3 5: 出现且仅出现 2 0 1 3 【AC】 阅读全文
posted @ 2018-06-18 12:30 shulin15 阅读(196) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 12 using namespace std; 13 typedef long long ll; 14 const dou... 阅读全文
posted @ 2018-06-17 23:27 shulin15 阅读(311) 评论(0) 推荐(0) 编辑
摘要:【思路】 多个起点同时四周扩展广搜,注意会爆int 【AC】 阅读全文
posted @ 2018-06-17 17:29 shulin15 阅读(295) 评论(1) 推荐(0) 编辑
摘要:#include #include #include #include #include #include using namespace std; const int maxn=2e4+2; const int maxm=2e4+2; const int inf=0x3f3f3f3f; int n,m; struct edge{ int to; int nxt; }e[2*m... 阅读全文
posted @ 2018-06-17 15:15 shulin15 阅读(133) 评论(0) 推荐(0) 编辑
摘要:【AC】 阅读全文
posted @ 2018-06-17 15:14 shulin15 阅读(141) 评论(0) 推荐(0) 编辑
摘要:80分,暂时没找出20分的Bug 阅读全文
posted @ 2018-06-17 15:11 shulin15 阅读(259) 评论(0) 推荐(0) 编辑
摘要:【题意】 给定一个有向图,问图中互相可达(强连通)的点有多少对 【AC】 强连通缩点,缩点后是一个DAG,所以互相可达的点只在强连通块里。 阅读全文
posted @ 2018-06-17 12:18 shulin15 阅读(163) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include #include using namespace std; int n,m; const int maxn=1e4+2; const int maxm=5e4+2; int degree[maxn]; int fa[maxn]; struct edge{ int to; ... 阅读全文
posted @ 2018-06-16 21:44 shulin15 阅读(140) 评论(0) 推荐(0) 编辑
摘要:【题意】 给定有n个点,m条边的无向图,没有平行边和自环,求从1到n的路径中,最长段的最小值(最短路不再是路径和,而是所有段中的最大值) 【AC】 阅读全文
posted @ 2018-06-16 16:32 shulin15 阅读(156) 评论(0) 推荐(0) 编辑
摘要:去重!不然有环就直接挂掉了...0分 阅读全文
posted @ 2018-06-16 16:01 shulin15 阅读(161) 评论(0) 推荐(0) 编辑
摘要:【AC】 阅读全文
posted @ 2018-06-16 15:18 shulin15 阅读(244) 评论(0) 推荐(0) 编辑
摘要:【题意】 改编哈夫曼树,限制从左到右字母的编码按字典序递增 【思路】 因为是二进制编码,所以是二叉树; 因为是前缀码,所以每个字母都是叶子结点,不可能是内结点; 因为要按字典序递增,所以只能是相邻的结点结合,且排在前面的在左边,排在后面的在右边; 具有最优子结构性质:考虑f[i,j],可以由f[i, 阅读全文
posted @ 2018-06-16 11:12 shulin15 阅读(181) 评论(0) 推荐(0) 编辑
摘要:【题意】 给定一个无向图,求这个图满足所有点到顶点的最短路径不变的最小生成树 【AC】 注意双向边要开2*maxm 注意优先级队列 参考https://www.cnblogs.com/cielosun/p/5654595.html 阅读全文
posted @ 2018-06-15 23:50 shulin15 阅读(166) 评论(0) 推荐(0) 编辑
摘要:博弈论极小极大搜索,记忆化+状压 阅读全文
posted @ 2018-06-15 09:07 shulin15 阅读(673) 评论(0) 推荐(0) 编辑
摘要:poj.org/problem?id=1521 注意只有特殊情况:只有一种字母 阅读全文
posted @ 2018-06-14 15:39 shulin15 阅读(141) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5884 参考:https://www.cnblogs.com/jhz033/p/5879452.html 【题意】 n个有序序列的归并排序.每次可以选择不超过k个序列进行合并,合并代价为这些序列的长度和.总的合并代 阅读全文
posted @ 2018-06-14 14:45 shulin15 阅读(221) 评论(0) 推荐(0) 编辑
摘要:poj.org/problem?id=1339 方法二 数组排序+辅助队列(利用新加进来的内结点的单调性) 阅读全文
posted @ 2018-06-14 10:50 shulin15 阅读(227) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=2418 【注意】 1. 输入有空格,用 或 2. 而不是 【Accepted】 阅读全文
posted @ 2018-06-13 20:48 shulin15 阅读(188) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1577 【题意】 有一颗二叉搜索树,每次操作都把二叉搜索树的叶子从左到右揪掉(露出来的父节点就变成了新的叶子结点) 先给出了揪掉的叶子序列(多个字符串) 给出这课二叉搜索树先序遍历的结果 【思路】 最后揪掉的肯定是根,最后揪掉的是最先插入的,倒着 阅读全文
posted @ 2018-06-13 20:00 shulin15 阅读(296) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3791 【注意】 是看树的形态是否一样,而不是中序遍历的结果 【Accepted】 阅读全文
posted @ 2018-06-13 17:20 shulin15 阅读(122) 评论(0) 推荐(0) 编辑
摘要:【题意】 给定一棵树每个结点的权重和路径(路径用LR串表示),输出这棵树的层次遍历 【思路】 注意输入输出,sscanf用来格式化地截取需要的数据,strchr来在字符串中查找字符的位置 【Accepted】 阅读全文
posted @ 2018-06-13 00:32 shulin15 阅读(166) 评论(0) 推荐(0) 编辑
摘要:acm.hdu.edu.cn/showproblem.php?pid=1710 【题意】 给定一棵二叉树的前序遍历和中序遍历,输出后序遍历 【思路】 根据前序遍历和中序遍历递归建树,再后续遍历输出 malloc申请空间在堆,函数返回,内存不释放,需要free手动释放 【Accepted】 #incl 阅读全文
posted @ 2018-06-12 23:10 shulin15 阅读(142) 评论(0) 推荐(0) 编辑