Advertisement
Spocoman

01. Bonus Scoring System

Nov 3rd, 2023
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int students, lectures, bonus, maxAttendance = 0;
  8.     cin >> students >> lectures >> bonus;
  9.     int* attendances = new int[students];
  10.  
  11.     for (int i = 0; i < students; i++) {
  12.         cin >> attendances[i];
  13.         if (attendances[i] > maxAttendance) {
  14.             maxAttendance = attendances[i];
  15.         }
  16.     }
  17.  
  18.     cout << "Max Bonus: " << (lectures > 0 ? ceil(1.0 * maxAttendance / lectures * (5 + bonus)) : 0)
  19.         << ".\nThe student has attended " << maxAttendance << " lectures.\n";
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement