Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let badGradesInput = +input.shift();
- //mnogokratno se chetat
- let taskName = input.shift();
- let grade = +input.shift();
- //
- let badGradesCount = 0;
- let sumGrades = 0;
- let gradesCounter = 0;
- let lastProblem = "";
- let averageGrade = 0;
- while (badGradesCount < badGradesInput) {
- let taskName = input.shift();
- let grade = Number(input.shift());
- } if (taskName == "Enough") {
- averageGrade = sumGrades / gradesCounter;
- console.log(`Average score : ${averageGrade}`);
- break;
- } sumGrades += grade;
- ++gradesCounter
- if (grade <= 4) {
- ++badGradesCount
- lastProblem = taskName
- }
- if (badGradesCount == badGradesInput){
- console.log (`You need a break, ${badGradesCount} poor grades.`)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement