Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class AvrLoadTimeCalc
- {
- static void Main(string[] args)
- {
- List<List<string>> matrix = new List<List<string>>();
- string line = " ";
- while (line != string.Empty)
- {
- line = Console.ReadLine();
- String[] values = line.Split(new Char[] { ' ' });
- matrix.Add(new List<String>(values));
- }
- List<string> webSites = new List<string>();
- for (int i = 0; i < matrix.Capacity - 1; i++)
- {
- webSites.Add(matrix[i][2]);
- }
- Console.WriteLine(new string('-', 30));
- webSites.Sort();
- List<string> printWebSite = new List<string>();
- double counter = 0;
- double time = 0;
- for (int i = 0; i < webSites.Capacity - 1; i++)
- {
- for (int j = 0; j < webSites.Capacity - 1; j++)
- {
- if (webSites[i] == webSites[j])
- {
- time += double.Parse(matrix[i][3]);
- counter++;
- }
- }
- if (!printWebSite.Contains(webSites[i]))
- {
- Console.WriteLine("{0} -> {1}", webSites[i], time / counter);
- counter = 0;
- time = 0;
- printWebSite.Add(webSites[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement