fork 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. int N=5;
  13.  
  14. float fory[]=new float[N+1];
  15. float forx[]=new float[N+1];
  16. forx[N]=1;
  17.  
  18. for(int i=0;i<N;i++){
  19. int tempJ=1;
  20. if(i>0){
  21. for(int j=i+1;j>0;j--){
  22. tempJ=tempJ*j;
  23. }
  24. forx[i]=forx[i]+(tempJ);
  25. }
  26. else
  27. forx[0]=1;
  28. }
  29. for(int i=0;i<N;i++){
  30. fory[i]=0;
  31. if(i==0){
  32. fory[i]=1;
  33. }else if(i%2==0){
  34. fory[i]=fory[i]-(1.0f/forx[i]);
  35. }else if(i%2==1){
  36. fory[i]=fory[i]+(1.0f/forx[i]);
  37. }
  38. }
  39. for(int i=0;i<N;i++){
  40. forx[N]=forx[N]*(i+1);
  41. if(i!=0)
  42. fory[N]=fory[N]+fory[i];
  43. }
  44. N = Math.round(forx[N]*fory[N]);
  45. System.out.println(N);
  46. }
  47. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
44