Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Student_Academy
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = int.Parse(Console.ReadLine());
- var infoStudents = new Dictionary<string, List<double>>();
- for (int i = 1; i <= num; i++)
- {
- string name = Console.ReadLine();
- double grade = double.Parse(Console.ReadLine());
- if (!infoStudents.ContainsKey(name))
- {
- infoStudents.Add(name, new List<double>());
- infoStudents[name].Add(grade);
- }
- else
- {
- infoStudents[name].Add(grade);
- }
- }
- foreach (var kvp in infoStudents.OrderByDescending(x=>x.Key).ThenBy(x=>x.Value.Average()))
- {
- if ((kvp.Value.Average()) >= 4.50)
- {
- Console.WriteLine($"{kvp.Key} -> {(kvp.Value.Average()):f2}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment