Guest User

Untitled

a guest
Dec 9th, 2019
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2. let actorName = input[0];
  3. let academyPoints = +input[1];
  4. let raters = +input[2];
  5. let raterName = "";
  6. let currentPoints = 0;
  7. let points = academyPoints;
  8. let target = 1250.5;
  9. let end = raters * 3 - 2;
  10. let diff = 0;
  11. for (i = 3; i <= i + 3; i++, i++) {
  12. raterName = input[i];
  13. currentPoints = +input[i + 1];
  14. if (raterName == "") {
  15. break;
  16. }
  17. if (raterName !== "") {
  18. points += (raterName.length * currentPoints) / 2;
  19. }
  20. diff = target - points;
  21. if (points >= target) {
  22. output = `Congratulations, ${actorName} got a nominee for leading role with ${points.toFixed(
  23. 1
  24. )}!`;
  25. break;
  26. } else {
  27. output = `Sorry, ${actorName} you need ${diff.toFixed(1)} more!`;
  28. }
  29. }
  30. console.log(output);
  31. }
RAW Paste Data