Ledger Nano X - The secure hardware wallet
SHARE
TWEET

01. Bonus Scoring System

a guest Mar 28th, 2020 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.     input = input.map(x=>Number(x))
  3.     let students = input.shift()
  4.     let lectures = input.shift()
  5.     let initBonus = input.shift()
  6.     let highestScore =0;
  7.     for (let i = 0; i < students; i++) {
  8.         let student = input[i];
  9.         if (student>highestScore) {
  10.             highestScore=student;
  11.         }
  12.     }
  13.     let totalBonus = Math.ceil(highestScore/lectures*(5+initBonus))
  14.     console.log(`Max Bonus: ${totalBonus}.`);
  15.     console.log(`The student has attended ${highestScore} lectures.`);
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top