JAVA大数乘法 HDU1042

 1 import java.math.*;
 2 import java.util.Scanner;
 3 
 4 
 5 public class Main{
 6     public static void main(String[] args){
 7         int a;
 8         Scanner cin = new Scanner(System.in);
 9         while(cin.hasNext())
10         {
11             BigInteger ans=BigInteger.ONE;
12             a=cin.nextInt();
13             for(int i=1;i<=a;i++)
14             {
15                 ans=ans.multiply(BigInteger.valueOf(i));
16             }
17             System.out.println(ans);
18         }
19     }
20 }
View Code

 

posted @ 2015-08-04 20:24  相儒以沫  阅读(142)  评论(0编辑  收藏  举报