Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MultiDictionaries
- {
- class Program
- {
- static void Main(string[] args)
- {
- var studentsGrades = new Dictionary<string, List<double>>();
- double inputCount = double.Parse(Console.ReadLine());
- for(int i = 0; i < inputCount; i++)
- {
- string[] input = Console.ReadLine().Split(' ');
- string name = input[0];
- double grade = double.Parse(input[1]);
- int count = 0;
- double[] average = ;
- if(!studentsGrades.ContainsKey(name))
- {
- studentsGrades.Add(name,new List<double>());
- }
- studentsGrades[name].Add(grade);
- }
- foreach(KeyValuePair<string, List<double>> record in studentsGrades)
- {
- string name = record.Key;
- List<double> grades = record.Value;
- Console.WriteLine("{0} -> {1}", name, string.Join(" ", grades));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment