Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _02.TasksPlanner
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> hours = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToList();
- string[] command = Console.ReadLine().Split();
- string word = command[0];
- List<int> incompleted = new List<int>();
- int counterCompleted = 0;
- int counterIncomplete = 0;
- int counterDropped = 0;
- while (word != "End")
- {
- if (word == "Complete")
- {
- int index = int.Parse(command[1]);
- if (index >= 0 && index < hours.Count)
- {
- hours[index] = 0;
- }
- }
- else if (word == "Change")
- {
- int index = int.Parse(command[1]);
- int time = int.Parse(command[2]);
- if (index >= 0 && index < hours.Count)
- {
- hours[index] = time; ;
- }
- }
- else if (word == "Drop")
- {
- int index = int.Parse(command[1]);
- if (index >= 0 && index < hours.Count)
- {
- hours[index] = -1; ;
- }
- }
- if (word =="Count")
- {
- if (command[1] == "Completed")
- {
- for (int i = 0; i < hours.Count; i++)
- {
- if (hours[i] == 0)
- {
- counterCompleted++;
- }
- }
- Console.WriteLine(counterCompleted);
- }
- if (command[1] == "Incomplete")
- {
- for (int i = 0; i < hours.Count; i++)
- {
- if (hours[i] > 0)
- {
- counterIncomplete++;
- }
- }
- Console.WriteLine(counterIncomplete);
- }
- if (command[1] == "Dropped")
- {
- for (int i = 0; i < hours.Count; i++)
- {
- if (hours[i] < 0)
- {
- counterDropped++;
- }
- }
- Console.WriteLine(counterDropped);
- }
- }
- command = Console.ReadLine().Split();
- word = command[0];
- }
- for (int i = 0; i < hours.Count; i++)
- {
- if (hours[i] == 0)
- {
- hours.Remove(hours[i]);
- }
- }
- for (int i = 0; i < hours.Count; i++)
- {
- if (hours[i] < 0)
- {
- hours.Remove(hours[i]);
- }
- }
- Console.WriteLine(string.Join(" ",hours));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment