Advertisement
roronoa

moyenne deux à deux mean two by two 2

Nov 14th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const N = parseInt(readline());
  2. var inputs = readline().split(' ').map(a=>a*1);7
  3. //inputs.push(0)
  4. //print(inputs)
  5. let results = []
  6. let prec = -1
  7. for (let i = 0; i < N; i++) {
  8.     if(i%2 == 1) {
  9.         results.push((inputs[i]+prec)/2)
  10.         prec = -1
  11.     }
  12.     else if(i == N-1)
  13.         results.push((inputs[i])/2)
  14.     else
  15.         prec = inputs[i]
  16. }
  17. print(results.join(' '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement