Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars(input) {
- let name = input[0];
- let pointsFromAcademy = Number(input[1]);
- let juryCount = Number(input[2]);
- let currJury
- let jurypoints
- let nameJuryPoints
- let totalPoints
- for (let i = 3; i <= input.length; i + 1) {
- currJury = input[i++];
- nameJuryPoints = currJury.length
- jurypoints = Number(input[i++]);
- totalPoints = nameJuryPoints * jurypoints / 2
- if (pointsFromAcademy >= 1250.5) {
- break;
- }
- juryCount--
- pointsFromAcademy += totalPoints
- if (juryCount == 0) {
- break;
- }
- }
- if (pointsFromAcademy >= 1250.5) {
- console.log(`Congratulations, ${name} got a nominee for leading role with ${pointsFromAcademy.toFixed(1)}!`)
- } else if (pointsFromAcademy <= 1250.5) {
- console.log(`Sorry, ${name} you need ${(1250.5 - pointsFromAcademy).toFixed(1)} more!`)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement