这道大数乘法开始我是想套板子模拟的..然后就发现2/3的例子都wa了.(惊了).然后在思考后发现n2的板子的确过不了这么多的大数.(不看题的下场).所以,我在网上发现了分块求大数的方法.%%% 思路来自这位大佬的帖子>>http://blog.csdn.net/f_zyj/article/details/51187056<< 总的来说,就是把这个乘积分成8位数(自己定)一小块,然后考虑进位,最后倒着输出来就行. 代码如下: #include<iostream> #inc…
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1042 题目大意:求n!, n 的上限是10000. 解题思路:高精度乘法 , 因为数据量比较大, 所以得用到缩进,但因为是乘法,缩进只能在10^5, 不然在乘的过程中就超过int型.然后数值位数大概在8000位以下. #include <iostream> #include <string.h> using namespace std; const int MAXN = 100000;…
Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in one line, process to the end of file.   Output For each N, output N! in one line.   Sample Input 1 2 3   Sample Output 1 2 6 一看到题目就想到用高精度乘法,用数组模拟小学学过…
Problem Description Givenan integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input OneN in one line, process to the end of file. Output Foreach N, output N! in one line. Sample Input 1 2 3 Sample Output 1 2 6 Author JGShining(极光炫影) /********* 高…
N!                                                                              Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!  …
题目链接:http://ac.jobdu.com/problem.php?pid=1076 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: #include <iostream> #include <stdio.h> #include <algorithm> #include <string.h> #include <cmath> #define MAX_SIZE 10010 usin…
B - 2 Time Limit:5000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1042 Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!  Input One N in one line, process to the end of file.  Out…
http://acm.hdu.edu.cn/showproblem.php?pid=1042 题意清晰..简单明了开门见山的大数乘法.. 10000的阶乘有35000多位 数组有36000够了 # include <stdio.h> # include <string.h> # define MAX 36000 int BigNum[MAX], NowLen; void Multi(int number) { int Temp[MAX]={0}, Tlen = 0, t;//Tem…
HDU 1042 N! 题意:给定整数N(0 ≤ N ≤ 10000), 求 N! (题目链接) #include <iostream> using namespace std; //每一个数组元素存放5位数 const int MAX=100000; //%MAX后结果为[0,99999] const int N=10001; //7132+1 int a[N]={0}; void prtBig(int n) { for(int i=0; i<n;i++) { if(i==0) //最…
题目链接:51nod 1027大数乘法 直接模板了. #include<cstdio> #include<cstring> using namespace std; ; ; ; int alen, blen; int ans_len; char a1[N], b1[N]; ], b[]; ]; ], int &len){ memset(c, , sizeof(c)); int L = strlen(s); len = L / DLEN; if(L%DLEN) len++;…