高精度 hdu 2940 Hex Factorial
2016-08-11 22:55
281 查看
直接暴力打表,也可以在代码外打表复制粘贴
#include<cstdio> #include<cstring> #include<cmath> using namespace std; const int BIT = 16; struct BIGint{ int bit[200]; void MEMset(){ memset(bit,0,sizeof(bit)); bit[1] = 1; } void multiply(int n){ int tmp; for (int i = 1;i < 200;++i) bit[i] *= n; for (int i = 1;i < 200;++i) if (tmp = bit[i] / BIT){ bit[i] %= BIT; bit[i+1] += tmp; } } int CountZore(){ int i = 199,ans(0); while( !bit[i--] ); while(i) if(!bit[i--])ans++; return ans; } }bigInt; int ans[110]; void init(){ memset(ans,0,sizeof(ans)); bigInt.MEMset(); for (int i = 2;i <= 101;++i){ bigInt.multiply(i); ans[i] = bigInt.CountZore(); } } int main () { init(); int n; while(~scanf("%d",&n) && n >= 0) printf("%d\n",ans ); return 0; }
相关文章推荐
- HDU 2940 Hex Factorial(高精度,打表)
- HDU 2940 Hex Factorial 高精度乘法
- HDU 2940 Hex Factorial(二进制乘法)
- Hex Factorial 高精度
- HDU 2940 Hex Factorial (简单高精度)
- hdu 1002(简单高精度)
- 【HDU】 1124 Factorial
- HDU 4002【高精度+欧拉函数+java】
- HDU1134 Game of Connections 高精度+DP
- hdu 5920(高精度 + 模拟)
- hdu 5351 MZL's Border 打表+高精度
- hdu 4382 模拟 矩阵连乘 高精度
- HDU 1042 N! 阶乘 高精度(java)
- HDU 1124 Factorial(数论)
- hdu 2940
- HDU 1969 高精度
- HDU-5973 Game of Taking Stones(威佐夫博弈+高精度)(C++高精度)
- HDU 6206 Apple(高精度浮点数)
- (高精度/Java)HDU 6206 Apple
- hdu 1250 Hat's Fibonacci(高精度数)