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