Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bgstudents;
- import java.util.*;
- public class main {
- public static void main(String[] args) {
- Scanner Input = new Scanner(System.in);
- int NumberOfStudents = Integer.parseInt(Input.nextLine());
- int CountOfTheLectores = Integer.parseInt(Input.nextLine());
- int BonusPoints = Integer.parseInt(Input.nextLine());
- Map <Integer,Double> Bonuses = new HashMap<>();
- Bonuses.put(0, 0.00);
- for(int i=1; i<=NumberOfStudents; i++) {
- int AttendceOfStudents = Integer.parseInt(Input.nextLine());
- double TotalBonus = (double)AttendceOfStudents / CountOfTheLectores * (5 + BonusPoints);
- Bonuses.put(AttendceOfStudents, TotalBonus);
- }
- Map.Entry<Integer, Double> Max = Bonuses.entrySet().stream()
- .max((a,b)->a.getValue().compareTo(b.getValue()))
- .get();
- System.out.printf("Max Bonus: %.0f.\nThe student has attended %s lectures.",Math.ceil(Max.getValue()),Max.getKey());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement