摘要: #include #include using namespace std; struct race { double p,h,c,flag; }; race r[101]; bool cmp(race a,race b) { //if() return a.flag... 阅读全文
posted @ 2014-12-11 17:51 __夜风 阅读(279) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; struct p { int endd,start; }; p p1[1000]; bool cmp(p p1,p p2) { return p1.endd>t&&t) { ... 阅读全文
posted @ 2014-12-11 17:50 __夜风 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 选择排序、快速排序、希尔排序、堆排序不是稳定的排序算法, 冒泡排序、插入排序、归并排序和基数排序是稳定的排序算法。 冒泡法: 这是最原始,也是众所周知的最慢的算法了。他的名字的由来因为它的工作看来象是冒泡: 复杂度为O(n*n)。当数据为正序,将不会有交换。复杂度为O(0)。 直接插入... 阅读全文
posted @ 2014-12-11 17:48 __夜风 阅读(129) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int main() { double a,b,c,d,e,f,t; while(cin>>t){ if(t==0) break; else { while... 阅读全文
posted @ 2014-12-11 17:45 __夜风 阅读(161) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int main() { int i,t,n; int a[101]; cin>>t; while(t--) { cin>>n; if(n==1) cout<<... 阅读全文
posted @ 2014-12-11 17:44 __夜风 阅读(95) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int cmp(int a,int b) { return a>b; } int main() { int i,t,a[10010]; cin>>t; for(i... 阅读全文
posted @ 2014-12-11 17:41 __夜风 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #include #define N 10010 using namespace std; int a[N],b[N]; int prime(int a) { int i; for(i=2;i*i>t>>x){ h=t;g=x; int ... 阅读全文
posted @ 2014-12-11 17:40 __夜风 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define LL __int64 using namespace std; bool ss(LL a) { LL i; for(i=2;i*i>m; s=(LL)sqrt(m+0.5); ... 阅读全文
posted @ 2014-12-11 17:40 __夜风 阅读(82) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int prime(int a) { int i; for(i=2;i*i>t&&t){ m=n=t; if(prime(t)==0) cout<<"0"<<endl; ... 阅读全文
posted @ 2014-12-11 17:38 __夜风 阅读(81) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; char a[10001]; int main() { int i,t,flag,n; cin>>t; getchar(); stack s;... 阅读全文
posted @ 2014-12-11 17:37 __夜风 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #include #include #define INF 9999999 //#define INF 0x3f3f3f3 using namespace std; int vis[200],dis[200],Map[200][200]; int dijkstra(int n,int x) ... 阅读全文
posted @ 2014-12-11 17:36 __夜风 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; const int INF=0x3f3f3f3f; int dis[110][110]; int main() { int i,j,k,n,m,p,q,s; while(scanf("%d%d",&... 阅读全文
posted @ 2014-12-11 17:34 __夜风 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int M[101][101]; int main() { int i,j,m,n,a,b,k; int flag; while(cin>>n>>m){ //flag=1; fo... 阅读全文
posted @ 2014-12-11 17:34 __夜风 阅读(75) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main() { int sum,m,len,t,i,k,s; char a[1001]; while(cin>>t) { sum=0; ... 阅读全文
posted @ 2014-12-11 17:30 __夜风 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; struct money { int s; int v; }; bool cmp(money a,money b) { return a.s>b.s; } int main() { money M[101]... 阅读全文
posted @ 2014-12-11 17:28 __夜风 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; int f[1000]; int digree[1000]; int find(int x) { while(x!=f[x]) x=find(f[x]); ret... 阅读全文
posted @ 2014-12-11 17:27 __夜风 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int Map[1001][1001],vis[1001][1001];int stx,sty,enx,eny,n,m,flag;int xx,yy,turn,k,i,j;int dx[]={1,0... 阅读全文
posted @ 2014-12-11 15:08 __夜风 阅读(209) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int M[101][101],flag[101][101];int n,m;int cnt;void pool(int x,int y){ flag[x][y]=1; M[x][y]=cn... 阅读全文
posted @ 2014-12-11 15:05 __夜风 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;int main(){ int n,i; int a[4]={1,2,3,4}; //cin>>n; while(next_permutation(a,a+4)){ for(i=0;iusi... 阅读全文
posted @ 2014-12-11 15:04 __夜风 阅读(190) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int main(){ int a[51][51],b[51][51],c[51][51],i,j,k,l,m,n; while(cin>>m>>n>>k,m+n+k>0) { for(i=1;i>a[i]... 阅读全文
posted @ 2014-12-11 15:03 __夜风 阅读(95) 评论(0) 推荐(0) 编辑