摘要: https://blog.csdn.net/StoneXieAC 阅读全文
posted @ 2019-01-23 21:06 StoneXie 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.org/problemnew/show/P1122 这题嘛 … 很明显的树形dp,但也有很多要注意的小点。 一开始题目打在了纸上,树的结构在第二面,然后当成了区间dp,嗯 … 代码就不贴了 于是我又打起了代码。 首先转移方程好想:默认选v节点,再递归,将 阅读全文
posted @ 2018-11-11 18:09 StoneXie 阅读(254) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; const int n=4; int a[]={0,5,6,8,10}; int erfenEqual(int low,int high,int key) { int mid; while(lowkey) high=mid-1; else ... 阅读全文
posted @ 2018-09-21 08:22 StoneXie 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 考虑负数: 关于cin,scanf,getchar 速度的比较可参考: https://blog.csdn.net/qq_33248299/article/details/52144485 阅读全文
posted @ 2018-09-07 15:57 StoneXie 阅读(295) 评论(0) 推荐(0) 编辑
摘要: getchar: 逐个字符读入,可以读入一切字符,包括空格符和回车符。这个函数很通用,可以代替以下所有函数。注意getchar连回车符都接受,接受回车符意味着可以判断读入的字符是不是'\n'。但以下所有函数都不接受空格符和回车符。 用法:char ch; ch=getchar();cin: 既可以读 阅读全文
posted @ 2018-09-07 10:54 StoneXie 阅读(1814) 评论(0) 推荐(0) 编辑
摘要: //转二叉树#include<iostream>#include<cstdio>#include<vector>using namespace std;struct Node{ int l,r;}; vector<int>E[310];//图的邻接表 int score[310],brother[3 阅读全文
posted @ 2018-09-04 14:42 StoneXie 阅读(878) 评论(0) 推荐(0) 编辑
摘要: 低难度 中等难度 高难度 并查集 Deep judge p1112 好朋友聚会 刘汝佳:元素化合物装车 杭电1232 畅通工程 杭电1829 A Bug's Life 洛谷 P2078朋友 Deep judge P1033银河英雄传说 杭电1558 Segment set 杭电1198 Farm I 阅读全文
posted @ 2018-08-22 15:08 StoneXie 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 第一天 1、luogu 2871 poj3624 charm bracelet 手链 01背包+状态压缩 2、poj 1384 piggy-bank 完全背包 3、poj 2387 the cows come home 最短路径模板 4、poj 3255 次短路 5、poj 3723 conscri 阅读全文
posted @ 2018-08-17 13:57 StoneXie 阅读(415) 评论(0) 推荐(0) 编辑
摘要: include<algorithm> 1 sort(起始地址,结束地址+1,比较函数)作用:对连续存储的元素从起始地址到结束地址从小到大排序情况1:从大到小排序定义比较函数例子: 情况2:结构体数组排序法1:重载运算符(定义在结构体内部) 法2:定义比较函数 2 find(起始地址,结束地址+1,查 阅读全文
posted @ 2018-08-14 08:23 StoneXie 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 1 并查集模板函数 2 最短路径算法 Dijkstra、spfa、foyd、Bellman-Ford四种算法的比较。 Dijkstra:求单源最短路径,仅适用于正权图,时间复杂度:o(n2),可用小根堆优化 Bellman-Ford:求单源最短路径,适用于正权图和负权图,判断并找出负权回路。时间复杂 阅读全文
posted @ 2018-08-08 20:39 StoneXie 阅读(338) 评论(0) 推荐(0) 编辑