Advertisement
Spocoman

01. Bonus Scoring System

Nov 3rd, 2023 (edited)
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BonusScoringSystem
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int students = int.Parse(Console.ReadLine());
  10.             int lectures = int.Parse(Console.ReadLine());
  11.             int bonus = int.Parse(Console.ReadLine());
  12.             int[] attendances = new int[students];
  13.  
  14.             for (int i = 0; i < students; i++)
  15.             {
  16.                 attendances[i] = int.Parse(Console.ReadLine());
  17.             }
  18.  
  19.             int maxBonus = (int)(lectures > 0 ? Math.Ceiling(1.0 * attendances.Max() / lectures * (5 + bonus)) : 0);
  20.  
  21.             Console.WriteLine($"Max Bonus: {maxBonus}.\nThe student has attended {(attendances.Sum() > 0 ? attendances.Max() : 0)} lectures.");
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement