摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1431run了好几次,当自己郁闷的时候突然看到了一句话,偶数位的回文串都可以被11整除当然要除了11,说明八位的数据可以全部忽略从9989899开始,这样问题就简单多了,减少了很多数的筛选与数组的空间,我们还可以先去除所有的偶数位的数再来筛选,这样可能更简单,看过还有打表的,真是佩服。。。#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>bool p[9989900] 阅读全文
posted @ 2011-08-04 22:09 ○o尐懶錨o 阅读(899) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2080这个题目是求角度,用向量的方法求的cosx,cosx等于向量之积除以向量的模的积,相信公式大家都会吧,然后用acos(cosx)就可以达到角度的大小,这道题还要注意精度代码:#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>#define PI 3.141592653int main(){ int n; double x1,x2,y1,y2,m,t; scanf 阅读全文
posted @ 2011-08-04 13:49 ○o尐懶錨o 阅读(787) 评论(0) 推荐(1) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1339这是一道很简单的英文题,就是求2^p与一个o相乘等于n,这样看来o一定是一个奇数,所以我们只要不断除以2一定可以得到一个奇数,若n是一个奇数就直接把n和0输出就可以了代码:#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>int main(){ int t,n,c; scanf("%d",&t); while(t--) { c=0; 阅读全文
posted @ 2011-08-04 11:34 ○o尐懶錨o 阅读(260) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2069这道题一看就是母函数,于是就觉得它很简单,出现了错误的代码:#include<stdio.h>int main(){ int n; int i,j,k; int a[1000],b[1000],num[6]={0,1,5,10,25,50}; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++) { a[i]=1; b[i]=0; } for(i=2;i<=5;i++) { for(j=0;j<=n;j++ 阅读全文
posted @ 2011-08-04 10:05 ○o尐懶錨o 阅读(187) 评论(0) 推荐(1) 编辑