本题大意:给定一个10000以内的整数n,让你求出n!并输出. 本题思路:先初始化一个存放答案的数组ans,初始ans[0] = 1,并初始化其剩下的元素为0,接着就从2开始依次与ans数组内的每一个数相乘,具体乘法过程见代码,需要注意的就是求divisor时自身此时的值也是需要加上的,还有就是注意当存在余数并且当前位数已经不够用的情况下才将总位数加一否则不加,答案里会出现很多前导零. #include <cstdio> #include <iostream> #include &…
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…
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…
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the…
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) //最…
两个小数相乘,会出现无限小数:先把小数乘以10或100或1000(小数点后有多少位就乘以多少),再相乘,最后再除以10或100或1000…
题目链接: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…
sdut oj 简单n! Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 给定一个数n(0 <= n <= 150), 求0到n中所有数的阶乘. 输入 题目有多组数据,处理到文件结尾.输入一个数n. 输出 输出阶乘,形式如:4! = 24.每组数据输出后跟一个空行. 示例输入 1 4 示例输出 0! = 1 1! = 1 0! = 1 1! = 1 2! = 2 3! = 6 4! = 24 提示  代码: #include…
http://acm.hdu.edu.cn/showproblem.php?pid=1212 题目大意: 给你一个长度不超过1000的大数A,还有一个不超过100000的B,让你快速求A % B. 什么?你说用大数的模板?那太慢了! 思路: 举个例子,1314 % 7= 5 由秦九韶公式: 1314= ((1*10+3)*10+1)*10+4 所以有 1314 % 7= ( ( (1 * 10   % 7  +3 )*10  % 7   +1)*10  % 7 +4   )%7 #include…
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…