2012年4月9日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2131求字母在单词中出现的概率,无视大小写View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int main(){ char sp,word[210]; int i,len,cnt; while(~scanf("%c%s%*c",&sp,word)) { len=strlen(word); cnt=0; for(i=0;i<len;i++) ... 阅读全文
posted @ 2012-04-09 23:56 LegendaryAC 阅读(191) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2523求差的绝对值第k大的数,注意相同的差算一个。分析出差的绝对值在[0,2000]这个范围内,由此可以搞出hash数组View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int abs(int a){ return a>0?a:-a;}int a[3000],hash[5000];int main(){ int t,n,k; int i,j; scanf("%d",& 阅读全文
posted @ 2012-04-09 23:31 LegendaryAC 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1196按要求直接做View Code #include <stdio.h>int pow(int a,int b){ int i,s=1; for(i=0;i<b;i++) s*=a; return s;}int main(){ int n,cnt,y; while(scanf("%d",&n),n) { cnt=0; while(1) { y=n%2; n/=2; ... 阅读全文
posted @ 2012-04-09 20:48 LegendaryAC 阅读(135) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2521题目蒙人,这题和反素数没关系求一个区间内因子数最多的最小的数View Code #include <stdio.h>#include <string.h>int main(){ int t,a,b,i,j; int cnt[6000]; int max,si; memset(cnt,0,sizeof(cnt)); cnt[1]=1; for(i=2;i<5001;i++) { for(j=2;j<=i/2;j++) if(i%... 阅读全文
posted @ 2012-04-09 14:05 LegendaryAC 阅读(297) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2190考虑两种砖,得出递推公式。a[i]=a[i-1]+2*a[i-2]View Code #include <stdio.h>int main(){ int n,i; __int64 a[40]={0,1,3}; for(i=3;i<=30;i++) a[i]=a[i-1]+2*a[i-2]; scanf("%d",&n); while(n--) { scanf("%d",&i); printf("%I64d\n" 阅读全文
posted @ 2012-04-09 12:54 LegendaryAC 阅读(685) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2187与2111一样,直接贪心即可View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>struct node{ int p,m;}kk[1100];int cmp(const void*a,const void*b){ struct node*c=(struct node*)a; struct node*d=(struct node*)b; retu 阅读全文
posted @ 2012-04-09 12:15 LegendaryAC 阅读(260) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2111直接贪心View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>struct node{ int p,m;}kk[110];int cmp(const void*a,const void*b){ struct node*c=(struct node*)a; struct node*d=(struct node*)b; return d->p- 阅读全文
posted @ 2012-04-09 11:28 LegendaryAC 阅读(169) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1995列表画一下,规律即出View Code #include <stdio.h>#include <string.h>#include <stdlib.h>__int64 pow(int a,int b){ int i; __int64 s=1; for(i=0;i<b;i++) s*=a; return s;}__int64 dp[70][70];int main(){ int t,n,m,i,j; for(i=1;i<61;i++) for... 阅读全文
posted @ 2012-04-09 10:47 LegendaryAC 阅读(178) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1564View Code #include <stdio.h>int main(){ int n; while(scanf("%d",&n),n) { if(n%2==0) printf("8600\n"); else printf("ailyanlu\n"); } return 0;} 阅读全文
posted @ 2012-04-09 00:01 LegendaryAC 阅读(158) 评论(0) 推荐(0) 编辑