摘要: stl应用:list map 新学:remove(value):找到容器中所有等于value的元素并删除之#include #include #include #include using namespace std;int main(){ int n,m; map x; map ... 阅读全文
posted @ 2014-11-12 00:50 Scale_the_heights 阅读(141) 评论(0) 推荐(0)
摘要: 最长路径,和最短路径差不多,用了spfa来求#include #include #include #include #define N 1000using namespace std;int g[N][N];int dis[N];int vis[N];void spfa(int n,int s){ ... 阅读全文
posted @ 2014-11-10 22:49 Scale_the_heights 阅读(157) 评论(0) 推荐(0)
摘要: 直接找路径中最小值的最大值,最小的最大这个概念好好理解下就行了#include #include #include #include #define INF 1e10using namespace std;const int N=1000;int dis[N][N];int main(){ i... 阅读全文
posted @ 2014-11-10 22:46 Scale_the_heights 阅读(187) 评论(0) 推荐(0)
摘要: 最短路径问题/*解题关键点:1、度数为奇数的顶点(简称为奇顶点)个数必然为偶数。2、题目说明奇顶点数目小于等于2,所以奇顶点必然为0或2,当奇顶点个数为0的时候,肯定是一笔走完(欧拉),当奇顶点个数为2时,就转化为单源最短路径,并且起点和终点就是两个奇顶点*/#include #include #i... 阅读全文
posted @ 2014-11-10 13:41 Scale_the_heights 阅读(165) 评论(0) 推荐(0)
摘要: 离散话和区间修改:#include #include #include #include using namespace std;const int MAXN= 100010;int t[MAXN][2],s[MAXN>1; Build(l,mid,k>1; if(rs[... 阅读全文
posted @ 2014-11-08 18:31 Scale_the_heights 阅读(123) 评论(0) 推荐(0)
摘要: 区间修改#include #include #include using namespace std;const int MAXN = 100010;struct tree{ int l,r; long long sum,lz;}a[MAXN>1; Build(l,mid,... 阅读全文
posted @ 2014-11-08 18:28 Scale_the_heights 阅读(126) 评论(0) 推荐(0)
摘要: 线段树#include #include #include #define N 32010using namespace std;struct tree{ int l,r; int sum;}a[4*N];void build(int l,int r,int k){ a[k].l=... 阅读全文
posted @ 2014-11-08 18:27 Scale_the_heights 阅读(123) 评论(0) 推荐(0)
摘要: 一道纯数学题,但是老师把这到题归为tree不知道是为什么#include #include #include #define N 0.1using namespace std;int main(){ int n,m; while(~scanf("%d%d",&n,&m)&& (n!=0 ... 阅读全文
posted @ 2014-11-01 00:31 Scale_the_heights 阅读(169) 评论(0) 推荐(0)
摘要: #include #include #include #include #include using namespace std;const int N=260;string str[N];bool ffflag=true;struct Node{ string num; string ... 阅读全文
posted @ 2014-10-31 15:48 Scale_the_heights 阅读(137) 评论(0) 推荐(0)
摘要: 已知前序中序求后序#include #include #include #include using namespace std;string po;void Computing(string pre,string in){ int len=pre.length(); if(len>0)... 阅读全文
posted @ 2014-10-29 19:33 Scale_the_heights 阅读(139) 评论(0) 推荐(0)