HDU 1042 N!(高精度计算阶乘)】的更多相关文章

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…
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) //最…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34687    Accepted Submission(s): 9711 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in one…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 100274    Accepted Submission(s): 30006 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 55659    Accepted Submission(s): 15822 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in on…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1042 N! 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 123 Sample…
题目连接: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 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(极光炫影) /********* 高…
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.   题目大意:求N的阶乘. 思路:用高精度,内存存不下这么多只能每次都重新算了…… 代码(3093MS): //模板测试 #inclu…
题意:求n!(0 ≤ N ≤ 10000) 思路:大数,用数组存储 1.首先要考虑数据N!的位数,因为最大是10000!,可以计算一下大概是5+9000*4+900*3+90*2+10*1=38865位,(此处没看懂,怎么求的) 可以开一个40000的int数组存放,然后用常规的方法去计算 2.但是需要改进一下,咱们知道int数组一个只存1位太浪费了,不如让它的空间发挥到极限,数组一个元素存一个不超过10^5的数, 为什么是10^5呢?见代码中的注释,改进后就一个元素存5位,这样开的数组就可以小…