Advertisement
Liliana797979

viarno reshenie na oscars

Feb 3rd, 2021
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2. function oscars(input) {
  3.   let name = input.shift();
  4.   let totalPoints = Number(input.shift());
  5.   let actors = Number(input.shift());
  6.  
  7.   for (let i = 1; i <= actors; i++) {
  8.     let actor = input.shift();
  9.     let testPoints = Number(input.shift());
  10.     totalPoints += (actor.length * testPoints) / 2;
  11.  
  12.     if (totalPoints > 1250.5) {
  13.       break;
  14.     }
  15.   }
  16.  
  17.   if (totalPoints > 1250.5) {
  18.     console.log(`Congratulations, ${name} got a nominee for leading role with ${totalPoints.toFixed(1)}!`);
  19.   } else {
  20.     console.log(`Sorry, ${name} you need ${(1250.5 - totalPoints).toFixed(1)} more!`);
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement