1 2 3
1 2 6
import java.util.Scanner; import java.math.BigInteger; public class yhrtr { public static void main(String[] args) { Scanner cin = new Scanner (System.in); while(cin.hasNext()) { BigInteger s = BigInteger.ONE; int n = cin.nextInt(); for(int i=1;i<=n;i++) s = s.multiply(BigInteger.valueOf(i)); System.out.println(s); } } }
原文地址:http://blog.csdn.net/hyccfy/article/details/38230899