HDOJ 1042
来源:互联网 发布:谢云流小时候捏脸数据 编辑:程序博客网 时间:2024/05/28 01:34
N!
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44090 Accepted Submission(s): 12421
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
123
Sample Output
126
Author
JGShining(极光炫影)
裸地高精度,直接JAVA水过,一开始以为0! = 1,还去特判了,真是脑残了
import java.io.*;import java.util.*;import java.math.*;/** * * @author XM_zhou */public class Main{ public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); int n; BigInteger ans; while (cin.hasNextInt()) { n = cin.nextInt(); ans = BigInteger.ONE; for (int i = 2; i <= n; i++) { ans = ans.multiply(BigInteger.valueOf(i)); } System.out.println(ans); } }}
- hdoj 1042
- HDOJ 1042
- hdoj 1042
- HDOJ 1042
- HDOJ 1042
- HDOJ 1042 N!
- hdoj 1042 N!(高精度)
- HDOJ 1042 N!
- ACM HDOJ 1042 (N!)
- HDOJ 1042 N!
- hdoj 1042 N!
- N! hdoj 1042
- HDOJ 1042 N!
- HDoj-1042 大数阶乘
- hdoj 1042 N!
- hdoj 1042 N!
- hdoj-1042 N!
- HDOJ 1042 N!
- 克鲁斯卡尔(Kruskal)算法
- hdu -1241 Oil Deposits
- android 将一个bitmap保存成图片文件
- gcc静态库链接的问题
- hdu2802之矩阵乘法
- HDOJ 1042
- Linux中如何创建静态库和动态库
- 优秀Jquery插件
- 解决Ajax请求出现Uncaught SyntaxError: Unexpected token : 错误
- 【美化§风景之雾漫城市之颠win7电脑主题】
- 如何在Eclipse中查看Java类库的源代码以及相应的api
- Decorator 模式
- getOutputStream() has already been called for this response
- 使用文件映射获取打开的文件名