Advertisement
roronoa

test race course

Sep 11th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n=parseInt(readline())
  2. t=[]
  3. s=({j,k},{l,m})=>(j-l)**2+(k-m)**2
  4. for(let i = 0; i < n; i++) {
  5.      e = readline().split(' ');
  6.      t.push({x:e[0]*1,y:e[1]*1})
  7. }
  8. t.forEach( ({x,y})=>print(x,y) )
  9. print(t.reduce((z,q)=>z+s({z.x,z.y},{q.x,q.y}),0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement