Advertisement
roronoa

x**n donne une liste, trouver n

Oct 10th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var inputs = readline().split(' ');
  3. let t = []
  4. for (let i = 0; i < 15; i++) {
  5.     const x = parseInt(inputs[i]);
  6.     t.push(x)
  7. }
  8. let allZeros = (tab) => tab.reduce((a,b)=>a*1+b,0)==0
  9. let etapes = 0
  10. while(!allZeros(t))
  11. {
  12.     let tmp = []  
  13.     for(let i = 1; i < t.length; i++)
  14.     {
  15.         tmp.push(t[i] - t[i-1])
  16.     }
  17.     t = tmp
  18.     etapes++
  19. }
  20. console.log(etapes-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement