hdu1042-N!-(java大数)
题目:求n!(0<=n<=10000)
import java.math.BigInteger;//操作大整数 import java.math.BigDecimal;//操作大小数 import java.io.BufferedInputStream; import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String []args) { BigInteger ans; Scanner scan=new Scanner(System.in); int n; while(scan.hasNext()) { n=scan.nextInt(); ans=BigInteger.valueOf(1);///大数类型不能直接赋值1 for(int i=1;i<=n;i++) ans=ans.multiply(BigInteger.valueOf(i)); System.out.println(ans); } } }