fork(7) download
  1. import java.util.*;
  2. import java.math.*;
  3. import java.io.*;
  4.  
  5. class SmallFactorials {
  6.  
  7. private static final BigInteger[] fact = new BigInteger[101];
  8. static {
  9. fact[1] = BigInteger.ONE;
  10. for ( int i = 2; i <= 100; ++i ) {
  11. fact[i] = fact[i-1].multiply( BigInteger.valueOf( i ) );
  12. }
  13. }
  14.  
  15. public static void main( String[] args ) throws Exception {
  16. int T = Integer.parseInt( br.readLine() );
  17. while ( T-- > 0 ) {
  18. int f = Integer.parseInt( br.readLine() );
  19. System.out.println( fact[f] );
  20. }
  21. }
  22. }
Success #stdin #stdout 0.07s 380224KB
stdin
10
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
85
90
95
100
stdout
3628800
1307674368000
2432902008176640000
15511210043330985984000000
265252859812191058636308480000000
10333147966386144929666651337523200000000
815915283247897734345611269596115894272000000000
119622220865480194561963161495657715064383733760000000000
30414093201713378043612608166064768844377641568960512000000000000
12696403353658275925965100847566516959580321051449436762275840000000000000