Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- input = input.map(x=>Number(x))
- let students = input.shift()
- let lectures = input.shift()
- let initBonus = input.shift()
- let highestScore =0;
- for (let i = 0; i < students; i++) {
- let student = input[i];
- if (student>highestScore) {
- highestScore=student;
- }
- }
- let totalBonus = Math.ceil(highestScore/lectures*(5+initBonus))
- console.log(`Max Bonus: ${totalBonus}.`);
- console.log(`The student has attended ${highestScore} lectures.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement