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) //最…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1042 Problem Description Given an integer N( ≤ N ≤ ), 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 Sample…
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…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 73503    Accepted Submission(s): 21308 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in…
题意:求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位,这样开的数组就可以小…
这道题一开始就采用将一万个解的表打好的话,虽然时间效率比较高,但是内存占用太大,就MLE 这里写好大数后,每次输入一个n,然后再老老实实一个个求阶层就好 java代码: /** * @(#)Main.java * * * @author * @version 1.00 2014/12/21 */ import java.util.*; import java.math.*; public class Main { //public static BigInteger a [] = new Big…
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: 262144/262144 K (Java/Others) Total Submission(s): 65350    Accepted Submission(s): 18696 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5047 解题报告:问一个“M”型可以把一个矩形的平面最多分割成多少块. 输入是有n个“M",现在已经推出这个公式应该是8 * n^2 - 7 * n + 1,但是这个n的范围达到了10^12次方,只要平方一次就超出long long  的范围了,怎么办呢,用大数? 都试过了,很奇怪,会超时,按照估算的话感觉不会,可能是中间结果比较大吧,这个还在思考,但是10^12平方一次乘以八也只达到了10^25次方…