Advertisement
Lyubohd

01. Bonus Scoring System

Jul 1st, 2020
1,178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Fund
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             int studentsCount = int.Parse(Console.ReadLine());
  12.             int lecturesCount = int.Parse(Console.ReadLine());
  13.             int initialBonus = int.Parse(Console.ReadLine());
  14.             double maxBonus = 0;
  15.             int maxStudentAttendances = 0;
  16.  
  17.             for (int i = 0; i < studentsCount; i++)
  18.             {
  19.                 int attendace = int.Parse(Console.ReadLine());
  20.                 double totalBonus = attendace * 1.0 / lecturesCount * (5 + initialBonus);
  21.  
  22.                 if (totalBonus > maxBonus)
  23.                 {
  24.                     maxBonus = totalBonus;
  25.                     maxStudentAttendances = attendace;
  26.                 }
  27.             }
  28.             Console.WriteLine($"Max Bonus: {Math.Ceiling(maxBonus)}.");
  29.             Console.WriteLine($"The student has attended {maxStudentAttendances} lectures.");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement