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.lenght * tempPoints) / 2;
- if (points > 1250.5) {
- console.log(`Congratulations, ${nameActor} got a nominee for leading role with ${points}`);
- isNominee = true;
- break;
- }
- }
- if (!isNominee) {
- let diff = 1250.5 - points;
- console.log(`Sorry, ${nameActor} you need ${diff} more!`);
- }
- }
- oscars(["Zahari Baharov",
- "205",
- "4",
- "Johnny Depp",
- "45",
- "Will Smith",
- "29",
- "Jet Lee",
- "10",
- "Matthew Mcconaughey",
- "39"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement