先留下一段代码,以后再写
HDU 1042 N!
import java.io.BufferedInputStream; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner cin = new Scanner(new BufferedInputStream(System.in)); while(cin.hasNextBigInteger()){ BigInteger s = cin.nextBigInteger(); BigInteger one = BigInteger.valueOf(1); BigInteger ans = BigInteger.valueOf(1); BigInteger tmp = BigInteger.valueOf(1); for(;tmp.compareTo(s)<=0;){ ans=ans.multiply(tmp); tmp=tmp.add(one); //System.out.println(tmp); } System.out.println(ans); } } }
原文地址:http://blog.csdn.net/cnh294141800/article/details/45046231