fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner leer = new Scanner(System.in);
  13.  
  14. int M,N;
  15. long FM=1,FN=1,SU;
  16.  
  17. M=leer.nextInt();
  18. N=leer.nextInt();
  19.  
  20. if(M>0) for(int i=1;i<=M;i++) FM=FM*i;
  21. if(N>0) for(int i=1;i<=N;i++) FN=FN*i;
  22.  
  23.  
  24.  
  25. System.out.println(FM);
  26. System.out.println(FN);
  27.  
  28. SU=FM+FN;
  29.  
  30. System.out.println(SU);
  31.  
  32. }
  33. }
Success #stdin #stdout 0.13s 29428KB
stdin
21 0
stdout
-4249290049419214848
1
-4249290049419214847