上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 47 下一页

2012年4月25日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1492计算约数的个数,由已知条件"A number whose only prime factors are 2,3,5 or 7 is called a humble number."简化运算。View Code #include <stdio.h>__int64 find(__int64 n,int a){ __int64 ans=0; while(1) { if(n==1)break; if(n%a==0) { ans++... 阅读全文
posted @ 2012-04-25 03:24 LegendaryAC 阅读(252) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1593吐槽:大晚上的说好复习高数又有点变味儿了、、、囧这道题问的是怎么能够逃脱。开始写的直接往相反方向跑,wa了,查别人的解题报告说找同心圆使两人角速度相等,然后再往反方向跑。代码很简单,但不太容易想。ps:角速度w=v/rView Code #include <stdio.h>#define PI 3.1415926535int main(){ double r,v1,v2; while(~scanf("%lf%lf%lf",&r,&v1,&v2)) 阅读全文
posted @ 2012-04-25 03:05 LegendaryAC 阅读(254) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.bjtu.edu.cn/problem/detail?pid=1188百万级素数筛选,果断埃斯托拉尼筛法View Code #include <stdio.h>int prime[1000001];int ans[1000001]={0,0,1};int main(){ int i,j,n; for(i=2;i*i<=1000000;i++) if(!prime[i]) for(j=i;j*i<=1000000;j++) prime[j*i]=1; for(i=3;i<=1000000;i... 阅读全文
posted @ 2012-04-25 01:51 LegendaryAC 阅读(186) 评论(0) 推荐(0) 编辑

2012年4月24日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1087求最长上升子序列问题View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int main(){ int n,i,j; int a[1100],dp[1100]; while(scanf("%d",&n),n) { for(i=0;i< 阅读全文
posted @ 2012-04-24 21:30 LegendaryAC 阅读(122) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2103bs这道题,我坚信生男生女都一样!ps:不提前把几个0打出来的话要用__int64,否则会超范围View Code #include <stdio.h>int main(){ int t,m,n; int i; int bb,cnt,f; __int64 ans,fj; scanf("%d",&t); while(t--) { cnt=ans=f=0; fj=10000; scanf("%d%d",&m,&n); ... 阅读全文
posted @ 2012-04-24 20:57 LegendaryAC 阅读(227) 评论(0) 推荐(0) 编辑

2012年4月23日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1222题意:判断兔纸酱能否存活求最大公约数。分析:如狼能从0到1,则狼能到任意洞。要使狼能到1,则gcd(m,n)=1View Code #include <stdio.h>int gcd(int a,int b){ return a%b==0?b:gcd(b,a%b);}int main(){ int p,m,n; scanf("%d",&p); while(p--) { scanf("%d%d",&m,&n); if(gcd(m, 阅读全文
posted @ 2012-04-23 23:09 LegendaryAC 阅读(156) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4104第一遍看了眼数据,直接输出所有数的和加1,居然过了,不过我相信一切都是有原因的~View Code #include <stdio.h>int main(){ int n,s,a,i; while(~scanf("%d",&n)) { s=0; for(i=0;i<n;i++) { scanf("%d",&a); s+=a; } printf("%d\n",s+1); ... 阅读全文
posted @ 2012-04-23 22:48 LegendaryAC 阅读(200) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2719按要求处理字符串View Code #include <stdio.h>#include <string.h>int main(){ char s[1100]; char tab1[30]={' ','!','$','%','(',')','*'}; char tab2[10][20]={{"%20"},{"%21"},{&quo 阅读全文
posted @ 2012-04-23 22:35 LegendaryAC 阅读(194) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2734按规则计算就行,很简单、、、View Code #include <stdio.h>#include <string.h>int main(){ char s[1100]; char tab[30]={' ','A','B','C','D','E','F','G','H','I','J','K 阅读全文
posted @ 2012-04-23 22:24 LegendaryAC 阅读(197) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2700读懂了发现就是一个奇偶判断View Code #include <stdio.h>#include <string.h>int main(){ char s[1100]; int len,cnt,i; while(gets(s)) { cnt=0; if(s[0]=='#')break; len=strlen(s); for(i=0;i<len-1;i++) if(s[i]=='1')cnt++; ... 阅读全文
posted @ 2012-04-23 22:15 LegendaryAC 阅读(229) 评论(0) 推荐(0) 编辑
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 47 下一页