2012年4月25日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1176类似数塔的dp,注意边界处理!!!View Code #include <stdio.h>#include <string.h>int dp[110000][30];int max3(int a,int b,int c){ int maxnum=a; if(maxnum<b)maxnum=b; if(maxnum<c)maxnum=c; return maxnum;}int max2(int a,int b){ return a>b?a:b;}int main( 阅读全文
posted @ 2012-04-25 22:12 LegendaryAC 阅读(151) 评论(0) 推荐(0) 编辑
 
摘要: 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) 编辑