11 2014 档案

摘要:#include#include#include#include#include#include#includeusing namespace std;const int Max=1000;int Top=1,Mtop=0,add[Max];int High(int a){ add[1]+=a... 阅读全文
posted @ 2014-11-06 20:44 endl 阅读(397) 评论(0) 推荐(0)
摘要://差分思想 #include#include#include#include#include#include#includeusing namespace std;const int MAX=100010;int a[MAX],t[MAX];void change(int x,int y,int ... 阅读全文
posted @ 2014-11-06 16:36 endl 阅读(125) 评论(0) 推荐(0)
摘要:树状数组#include#include#include#include#include#include#includeusing namespace std;const int MAX=100000+10;int N,X;int c[MAX];void add(int x,int v){ w... 阅读全文
posted @ 2014-11-06 16:01 endl 阅读(117) 评论(0) 推荐(0)
摘要:Dp 适合点少的稠密图。//蒟蒻 最短路 #include#include#include#include#include#include#includeusing namespace std;int main(){ int n,m,edge[110][110]; scanf("%d%d... 阅读全文
posted @ 2014-11-06 15:48 endl 阅读(111) 评论(0) 推荐(0)
摘要://最小生成树 用了贪心的思想每次选符合条件的最短边直到边取完 或 所有点之间已可互达。#include#include#include#include#include#include#includeusing namespace std;const int MAXN = 1000;struct e... 阅读全文
posted @ 2014-11-06 15:30 endl 阅读(109) 评论(0) 推荐(0)
摘要:// find 并查集 #include#include#include#include#include#include#includeusing namespace std;const int MAXN = 10000+10;int f[MAXN]; int find(int x){ if... 阅读全文
posted @ 2014-11-06 11:14 endl 阅读(175) 评论(0) 推荐(0)
摘要://gcd 最大公约数#include#include#include#include#include#include#includeusing namespace std;int gcd (int a,int b){ if(b==0) return a; return gcd(b,a%... 阅读全文
posted @ 2014-11-06 10:19 endl 阅读(227) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#include using namespace std;const int Max=100010;bool IsPrime[Max];int NumPrime[Max],phi[Max];int N,... 阅读全文
posted @ 2014-11-05 21:44 endl 阅读(193) 评论(0) 推荐(0)
摘要:用了质因数分解的方法://欧拉函数#include#include#include#include#include#include#includeusing namespace std;int ef(int n){ int cnt = n; for(int i=2;i<=n;i++) ... 阅读全文
posted @ 2014-11-05 20:21 endl 阅读(105) 评论(0) 推荐(0)
摘要:1 //质因数分解 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 int top=0,num[10000],time[10000];11 v... 阅读全文
posted @ 2014-11-05 19:47 endl 阅读(205) 评论(0) 推荐(0)
摘要:// 1 ~ 1000 素数 #include#include#include#include#include#include#includeusing namespace std;bool shu[10000];void sushu1 (int n)//O(n*sqrt(n));{ bool... 阅读全文
posted @ 2014-11-05 16:32 endl 阅读(129) 评论(0) 推荐(0)
摘要:spfa 裸题; 1 //spfa 链表 ; 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 const int N=2500+5,M=620... 阅读全文
posted @ 2014-11-05 15:31 endl 阅读(133) 评论(0) 推荐(0)
摘要:1 // power 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 typedef long long ll;11 ll power (in... 阅读全文
posted @ 2014-11-05 14:10 endl 阅读(157) 评论(0) 推荐(0)
摘要:想排序后进行操作,然后进行原序输出??;可以记录一个顺序,之后对顺序排序,但也可如下; 1 // cout 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 stru... 阅读全文
posted @ 2014-11-05 11:31 endl 阅读(158) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 struct strx10 {11 char c[20];12 int x;1... 阅读全文
posted @ 2014-11-05 11:19 endl 阅读(323) 评论(0) 推荐(0)
摘要:topsort 是对有向图的排序;#include//这个是判断环的 要求拓扑序的话就在其中加上计数的部分。using namespace std;priority_queue Q;bool topsort(){ for(int i=1;i<=n;i++) { if(indegree[i]... 阅读全文
posted @ 2014-11-04 20:30 endl 阅读(434) 评论(0) 推荐(0)
摘要:优先队列:可以当做一个堆用,对进入此结构的类型,可以找队首的元素。开库:#include定义: priority_queue Q;type:int类型 priority Q; 默认Q.top为队列中最大的;当我们要在队列中放入其他类型时,我们要用struct 在其中定义 operator Q.to... 阅读全文
posted @ 2014-11-02 21:27 endl 阅读(275) 评论(0) 推荐(0)