摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1568与 HDU 1060Leftmost Digit 差不多求后几位的话,可以构造矩阵相乘,二分求冪求前几位,不需要,直接运用数学公式和对数的性质来求斐波那契数列通项公式an=(1/√5)* [((1+√5)/2)^n-((1-√5)/2)^n]求x^y的前几位高斯函数x=[x]+{x},[x]为x的整数部分,{x}为x的小数部分运用对数性质,t=x^y=a*10^n(科学计数法)lgt=y*lgx=lga+n (n=[lgt],lga={lgt},因为1<=a<10,所以0<=lga&l
阅读全文
posted @ 2011-11-28 20:31
Qiuqiqiu
阅读(258)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1271若n是奇数,只能去掉a的最后一个数字若n是偶数,枚举每一位数字View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 int ans[100]={0},n; 4 int cmp(const void *a,const void *b) 5 { 6 return *(int*)a-*(int*)b; 7 } 8 int f(int x) 9 {10 if (x==0 || x-x/11*11>9) return -1;11
阅读全文
posted @ 2011-11-28 18:13
Qiuqiqiu
阅读(190)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1215类似于筛选法View Code 1 #include <stdio.h> 2 #include <string.h> 3 const int N=500001; 4 int f[N]; 5 int main() 6 { 7 memset(f,0,sizeof(f)); 8 for (int i=1;i<N;i++) 9 for (int j=i+i;j<N;j+=i) f[j]+=i;10 int T,n;11 scanf("%d",&T)
阅读全文
posted @ 2011-11-28 15:51
Qiuqiqiu
阅读(157)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1060求x^y的前几位高斯函数x=[x]+{x},[x]为x的整数部分,{x}为x的小数部分运用对数性质,t=x^y=a*10^n(科学计数法)lgt=y*lgx=lga+n (n=[lgt],lga={lgt},因为1<=a<10,所以0<=lga<1)a=10^{lgt}e=y*lgx, e=e-[e], a=10^eView Code 1 #include <stdio.h> 2 #include <math.h> 3 int main() 4 { 5 i
阅读全文
posted @ 2011-11-28 15:48
Qiuqiqiu
阅读(100)
推荐(0)
编辑