上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: #include <iostream>using namespace std;const int N=30;const int Max=105;//costint cost[N][N],d[N],total,n;bool f[N];void init(){ for(int i=1;i<=n;i++) { f[i]=0; d[i]=Max; for(int j=i+1;j<=n;j++) { cost[i][j]=Max; cost[j][i]=Max; } } ... 阅读全文
posted @ 2012-02-13 19:01 wuzhibin 阅读(170) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 4000125 at 2012-02-12 18:42:46*/#include <stdio.h>#include <iostream>#include <memory.h>using namespace std;const int N=102;bool f[N];int pre[N];double v[N],p[N][N];int n,m;void init(){ int p1,p2,pro; memset(f,0,sizeof(f)); memse... 阅读全文
posted @ 2012-02-12 19:04 wuzhibin 阅读(166) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1564 at 2012-02-11 22:11:42*/#include <stdio.h> #include <iostream> using namespace std; const int N=30003;int rt[N+5],rank[N+5],suspect[N+5];void init(){ for(int i=0;i<=N;i++) { rt[i]=i; rank[i]=1; ... 阅读全文
posted @ 2012-02-12 19:02 wuzhibin 阅读(153) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 2676 at 2012-02-11 17:27:50*/#include <stdio.h> #include <iostream> using namespace std; const int N=5000;int root[N+5],rank[N+5];void init(){ for(int i=1;i<=N;i++) { root[i]=i; rank[i]=1; } ... 阅读全文
posted @ 2012-02-11 17:32 wuzhibin 阅读(142) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1640 at 2012-02-10 20:37:39*/#include <iostream>#include <stdio.h>using namespace std;const int N=1030;int t[N][N],maxi,maxj;/*int lowbit(int k){ return k & (k ^(k - 1));}void update(int x, int y, int val){ for (int i = x; i <= max 阅读全文
posted @ 2012-02-11 17:31 wuzhibin 阅读(237) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1867 at 2012-02-09 14:48:18*/#include <iostream>#include <cstring>#include <queue>#include <set>#include <deque>using namespace std;const int N=1000001;const int M=1000001;int in[N+1];int pn,p[M],a[N];bool f[10000001];in 阅读全文
posted @ 2012-02-09 14:51 wuzhibin 阅读(288) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1965 at 2012-02-06 21:00:43*/#include <iostream>using namespace std;const int NUM=1442;//the number of the most carsint m[NUM+1],step[NUM+1],tmp[NUM+1],pre[NUM+1];int max(int x,int y){ return(x>y?x:y);}int main(int args,char** argv){ in... 阅读全文
posted @ 2012-02-08 17:59 wuzhibin 阅读(189) 评论(0) 推荐(0)
摘要: #include <iostream>#include <memory.h>using namespace std;int pow(int x){ int a=1; for(int i=1;i<=x;i++) a=10*a; return a;}int ln(int x){ int i=1; while(1) { if(pow(i)<=x) i++; else break; } return --i;}void half(int x,int h){ if(h==2) { while(x>0) { cout<<(x%10); x=x/10; 阅读全文
posted @ 2012-02-06 13:18 wuzhibin 阅读(133) 评论(0) 推荐(0)
摘要: 时间复杂度 o(n*lgn);zLen(i),jLen(i)表示以a[i]为末尾元素的递增,递减序列的长度#include <iostream>#include <memory.h>using namespace std;#define length 10000int zLen[length+5],jLen[length+5];int q[length+5];int min(int x,int y){ return(x<=y?x:y);}int find(int* a,int eid,int num){ int left=0; int right=eid; whi 阅读全文
posted @ 2012-02-05 19:43 wuzhibin 阅读(227) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 4000099 at 2012-01-27 15:36:46*/#include <iostream>#include <stdlib.h>#include <queue>using namespace std;struct point{ int x,y,f,step; }data[10][10];bool legal(int x,int y){ return (x<8&&x>=0&&y<8&& 阅读全文
posted @ 2012-02-04 17:50 wuzhibin 阅读(162) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 下一页