Exemplo n.º 1
0
    static void Main(string[] args)
    {
        int M = int.Parse(Console.ReadLine());
        int N = int.Parse(Console.ReadLine());

        Hipster[] hipsters = new Hipster[N];
        for (int i = 0; i < N; i++)
        {
            string[] input = Console.ReadLine().Split();
            hipsters[i] = new Hipster(int.Parse(input[0]), int.Parse(input[1]));
        }
        try
        {
            Kikstarter kikstarter = new Kikstarter(M, hipsters);
            Console.WriteLine(kikstarter.Run());
        }
        catch (ArgumentException ex)
        {
            Console.WriteLine(ex.Message);
        }
        catch (InvalidOperationException ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
Exemplo n.º 2
0
 private static void ReadHipsters(int hipstersCount, Hipster[] hipsters, Blogger[] bloggers)
 {
     for (int i = 0; i < hipstersCount; i++)
     {
         string[] arr = Console.ReadLine().Split();
         hipsters[i] = new Hipster(int.Parse(arr[0]), int.Parse(arr[1]));
         for (int j = 2; j < arr.Length; j++)
         {
             hipsters[i].Subscribe(bloggers[int.Parse(arr[j])]);
         }
     }
 }
Exemplo n.º 3
0
    public static void Main(string[] args)
    {
        int hipstersCount = int.Parse(Console.ReadLine());
        int bloggersCount = int.Parse(Console.ReadLine());

        Hipster[] hipsters = new Hipster[hipstersCount];
        Blogger[] bloggers = new Blogger[bloggersCount];
        Calendar  calendar = new Calendar();

        for (int i = 0; i < bloggersCount; i++)
        {
            bloggers[i] = new Blogger((DayOfWeek)int.Parse(Console.ReadLine()));
            calendar.EveryDayNotification += bloggers[i].MakePost;
        }
        ReadHipsters(hipstersCount, hipsters, bloggers);
        calendar.Simulate(new DateTime(2019, 1, 1), new DateTime(2019, 12, 31));
        PrintResult(hipsters);
    }