上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 47 下一页

2012年6月24日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1328最近发生了好多事,一言难尽。水一道。View Code #include <stdio.h>int main(){ int t ; scanf("%d",&t) ; for(int cas=1;cas<=t;cas++) { char str[51] ; scanf("%s",str) ; printf("String #%d\n",cas) ; for(int i=0;str[i];i++) if(s... 阅读全文
posted @ 2012-06-24 22:59 LegendaryAC 阅读(224) 评论(0) 推荐(0) 编辑

2012年6月16日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3293水一道排序题。。。希望今晚tc好运~View Code #include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct L{ char location[20],type[20],level[20] ; int ll ;}L ;L kk[501] ;int cmp(const void*a,const void*b){ L*c=(L*)a ; L*d=(L*)b ; if(!strcmp(c 阅读全文
posted @ 2012-06-16 21:15 LegendaryAC 阅读(171) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1878一个无向图存在欧拉回路,当且仅当该图所有顶点度数都是偶数且该图是连通图。连通图用并查集判断View Code #include using namespace std ;int hash[1002] ;int... 阅读全文
posted @ 2012-06-16 10:50 LegendaryAC 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2407yy题View Code #include <iostream>using namespace std ;int main(){ int n ; while(~scanf("%d",&n)) { double ans=1 ; for(int i=n-1;i>=2;i-=2) ans*=(i-1)*1.0/i ; printf("%.5lf\n",ans) ; } return 0 ;} 阅读全文
posted @ 2012-06-16 08:26 LegendaryAC 阅读(156) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2401水。。View Code #include <iostream>using namespace std ;int main(){ int n,w,d,s ; while(~scanf("%d%d%d%d",&n,&w,&d,&s)) { if(w*n*(n-1)/2==s) printf("%d\n",n) ; else printf("%d\n",(w*n*(n-1)/2-s)/d) ; } ret 阅读全文
posted @ 2012-06-16 08:02 LegendaryAC 阅读(209) 评论(0) 推荐(0) 编辑

2012年6月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2714水,按要求找到符合要求的解。。View Code #include <iostream>using namespace std ;int main(){ char str[30] ; int i ; while(~scanf("%s",str)) { int cnt=0 ; int pos ; for(i=0;str[i];i++) if(str[i]=='X') cnt+=10 ; ... 阅读全文
posted @ 2012-06-13 21:00 LegendaryAC 阅读(193) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4027线段树成段更新的题目,开方次数有限,一个区间都是1就lazy。仿hh风格的线段树,真漂亮啊View Code #include <iostream>#include <cmath>using namespace std ;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn=100002 ;typedef __int64 LL ;LL sum[maxn<<2] ;int l 阅读全文
posted @ 2012-06-13 19:44 LegendaryAC 阅读(187) 评论(0) 推荐(0) 编辑
 
摘要: 最近在自学数据结构,写了个最大堆模板,heap的大小到时候用malloc动态申请int heapsize, *heap;void up(int x){//自下而上调整堆 while(x != 1){ if(heap[x>>1] >1], heap[x]); ... 阅读全文
posted @ 2012-06-13 10:36 LegendaryAC 阅读(170) 评论(0) 推荐(0) 编辑

2012年6月12日

摘要: 好久都没喷人了,对于某些人的智商只能说呵呵。队都退了还要怎么样,做人留一线听不懂? 阅读全文
posted @ 2012-06-12 23:44 LegendaryAC 阅读(120) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1698做的第一道线段树成段更新的题目,lazy标志起到的作用的延迟更新(为了保证O(logN)的效率,不延迟就变成O(N))。这道题反正就询问一次,最后直接输出即可。View Code #include <iostream>using namespace std ; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1const int maxn=100002 ;int sum[maxn<<2] ;int lazy[ 阅读全文
posted @ 2012-06-12 21:14 LegendaryAC 阅读(151) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 47 下一页