1000! 建议用树组和biginteger分别写出来,让我门看看,谢谢!! (无内容)
import javax.swing.*;
import java.util.*;
import java.text.*;
public class Number extends JFrame{
public static void main(String[] args) {
String str = JOptionPane.showInputDialog("please input the number:");
int j = Integer.parseInt(str);
long[] a;
if(j<10001){
a=new long[2745];
}
else{
a=new long[j/2];
}
a[0]=1;
int len =1;
//计算
for (int i = j;i>1;i--){
long temp,up=0;
for(int k= 0;k<len;k++){
temp = a[k]*i+up;
a[k]=temp%100000000000000L;
up=temp/100000000000000L;
}
if(up>0){
a[len]=up;
len=len+1;
}
}
//打印
DecimalFormat myFormatter=new DecimalFormat("00000000000000");
System.out.print(a[len-1]);
for(int i=len-2;i>-1;i--){
System.out.print(myFormatter.format(a[i]));
}
System.exit(0);
}
}