Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int students, lectures, bonus, maxAttendance = 0;
- cin >> students >> lectures >> bonus;
- int* attendances = new int[students];
- for (int i = 0; i < students; i++) {
- cin >> attendances[i];
- if (attendances[i] > maxAttendance) {
- maxAttendance = attendances[i];
- }
- }
- cout << "Max Bonus: " << (lectures > 0 ? ceil(1.0 * maxAttendance / lectures * (5 + bonus)) : 0)
- << ".\nThe student has attended " << maxAttendance << " lectures.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement