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