Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars(input) {
- let actorName = input[0];
- let academyPoints = +input[1];
- let countOfJury = +input[2];
- let points = academyPoints;
- let juryNamesArr = [];
- let pointsArr = [];
- for (let i = 1; i <= countOfJury + countOfJury; i++) {
- if (i % 2 != 0) {
- juryNamesArr.push(input[i + 2])
- }
- }
- for (let i = 1; i <= countOfJury + countOfJury; i++) {
- if (i % 2 != 0) {
- pointsArr.push(input[i + 3])
- }
- }
- for (let i = 0; i < pointsArr.length; i++) {
- if (points.toFixed(1) > 1250.5) {
- console.log(`Congratulations, ${actorName} got a nominee for leading role with ${points.toFixed(1)}!`);
- break;
- }
- points += (pointsArr[i] * juryNamesArr[i].length) / 2;
- }
- if (points < 1250.5) {
- console.log(`Sorry, ${actorName} you need ${(Math.abs(points - 1250.5)).toFixed(1)} more!`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment