Advertisement
teofarov13

Untitled

Nov 2nd, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function oscars(input) {
  2.     let name = input[0];
  3.     let pointsFromAcademy = Number(input[1]);
  4.     let juryCount = Number(input[2]);
  5.     let currJury
  6.     let jurypoints
  7.     let nameJuryPoints
  8.     let totalPoints
  9.  
  10.     for (let i = 3; i <= input.length; i + 1) {
  11.         currJury = input[i++];
  12.         nameJuryPoints = currJury.length
  13.         jurypoints = Number(input[i++]);
  14.         totalPoints = nameJuryPoints * jurypoints / 2
  15.  
  16.  
  17.         if (pointsFromAcademy >= 1250.5) {
  18.  
  19.             break;
  20.         }
  21.         juryCount--
  22.         pointsFromAcademy += totalPoints
  23.         if (juryCount == 0) {
  24.  
  25.             break;
  26.         }
  27.     }
  28.     if (pointsFromAcademy >= 1250.5) {
  29.         console.log(`Congratulations, ${name} got a nominee for leading role with ${pointsFromAcademy.toFixed(1)}!`)
  30.     } else if (pointsFromAcademy <= 1250.5) {
  31.         console.log(`Sorry, ${name} you need ${(1250.5 - pointsFromAcademy).toFixed(1)} more!`)
  32.     }
  33.  
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement