HDU - 1042-N!(Java)】的更多相关文章

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…
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) //最…
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 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;…
n/(n)^(m-1) import java.io.*; import java.math.*; import java.util.*; public class Main { static BigInteger gcd(BigInteger a,BigInteger b) { if(b.equals(BigInteger.ZERO))return a; else return gcd(b,a.mod(b)); } public static void main(String arg[]) {…
大菲波数 Problem Description Fibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3.计算第n项Fibonacci数值.   Input 输入第一行为一个整数N,接下来N行为整数Pi(1<=Pi<=1000).   Output 输出为N行,每行为对应的f(Pi).   Sample Input 5 1 2 3 4 5   Sample Output 1 1 2 3 5   import java.math.BigInt…
题意:就是问你火车出战的方案数. 分析:卡特兰数的模板题,递推公式:a[n]=a[n-1]*(4*n-2)/(n+1). java代码实现: import java.util.*; import java.math.BigInteger; import java.io.*; public class Main { public static void main(String[] args) { BigInteger a[] = new BigInteger[101]; a[0] = BigInt…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 60244    Accepted Submission(s): 17166 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: 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…