Advertisement
CR7CR7

fac

Mar 21st, 2022
1,009
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = ['3',
  2. '2'
  3. ];
  4. let print = this.print || console.log;
  5. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  6.  
  7. var N = +gets();
  8. var X = +gets();
  9. var sum = 1;
  10. var y = 1;
  11.  
  12.  
  13. for(var i = 1; i <= N; i++){
  14.     y *= i;
  15.     sum += y/Math.pow(X,i);
  16.  
  17. }
  18.  
  19. print(sum.toFixed(5))
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
Advertisement
RAW Paste Data Copied
Advertisement