Advertisement
roronoa

progressive sum

Sep 1st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Auto-generated code below aims at helping you parse
  3.  * the standard input according to the problem statement.
  4.  **/
  5.  
  6. var inputs = readline().split(' ');
  7.  M = parseInt(inputs[0]);
  8.  D = parseInt(inputs[1]);
  9.  N = parseInt(inputs[2]);
  10. t = []
  11. while(N>0)
  12. {
  13.     t.push(M);
  14.     M = D+M;
  15.     N--;
  16.    
  17. }
  18.  
  19. console.log(t.reduce((a,b)=>a+b));
  20. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement