随笔分类 -  高精度

摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1753小数的高精度运算思路 把小数点前后分开存,然后统一进位,输出时再输出小数点。View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define N 405 4 int a[N]; 5 int b[N]; 6 int c[N]; 7 int a1[N]; 8 int b1[N]; 9 int c1[N]; 10 int d[N]; 11 char stra[1000]; 12 char strb[1000]; 13 阅读全文
posted @ 2012-08-03 18:44 时光旅行的懒猫 阅读(308) 评论(0) 推荐(0)
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1715MS我写的比较麻烦,各种进位什么的,学长说用递归加打表就可以搞定。我的View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define max 1000 4 char n1[max],n2[max],n3[max]; 5 void add(char *n1,char *n2,char *n3) 6 { 7 memset(n3,0,max); 8 int len=strlen(n1); 9 int i;10 ... 阅读全文
posted @ 2012-08-03 18:42 时光旅行的懒猫 阅读(490) 评论(1) 推荐(0)
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1047多个数的大数相加问题View Code 1 #include<stdio.h> 2 #include<string.h> 3 int a[100000]; 4 char b[100000]; 5 int main() 6 { 7 int n,i,j,t,max; 8 scanf("%d",&n); 9 getchar();10 while(n--)11 {12 memset(a,0,sizeof(a));13 while(... 阅读全文
posted @ 2012-08-03 17:48 时光旅行的懒猫 阅读(167) 评论(0) 推荐(0)
摘要:高精度阶乘问题以前从没做过高精度的问题 上午做的时候把高精度的加减乘都看了一遍 大概了解了下怎么做题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1042这个是看着乘法比着写的1、判断乘后大数的位数,此题约为40000;2、选择由那种类型数组存储,一般由int存储,一个数能存5位(10000*100000<2^31);3、确定数组长度,此题约为40000/5=8000;4、计算数组中每个数与普通数的乘积并存入数组;5、计算数组中每个数乘普通数的进位,加入高一位数组;6、输出时先计算使用了多少个的数组,然后向前输出数组。View Code 1 # 阅读全文
posted @ 2012-07-16 23:09 时光旅行的懒猫 阅读(159) 评论(0) 推荐(0)