Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02_MidArray
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] timeOfEachTaskArray = Console.ReadLine().Split();
- int[] timeOfEachTaskArrayIntiger = new int[timeOfEachTaskArray.Length];
- string command = "";
- int taskIntigerCheker = 0;
- int taskIntigerTime = 0;
- int dropTask = 0;
- int countIncomplete = 0;
- int completeCounter = 0;
- for (int i = 0; i < timeOfEachTaskArray.Length; i++)
- {
- timeOfEachTaskArrayIntiger[i] = int.Parse(timeOfEachTaskArray[i]);
- }
- while ((command = Console.ReadLine()) != "End")
- {
- string[] task = command.Split();
- for (int i = 0; i < timeOfEachTaskArrayIntiger.Length; i++)
- {
- if (timeOfEachTaskArrayIntiger[i] < 0)
- {
- continue;
- }
- if (task[0] == "Complete")
- {
- taskIntigerCheker = int.Parse(task[1]);
- if (taskIntigerCheker == i)
- {
- timeOfEachTaskArrayIntiger[i] = 0;
- }
- }
- else if (task[0] == "Change")
- {
- taskIntigerTime = int.Parse(task[2]);
- taskIntigerCheker = int.Parse(task[1]);
- if (taskIntigerCheker == i)
- {
- timeOfEachTaskArrayIntiger[i] = taskIntigerTime;
- }
- }
- else if (task[0] == "Drop" && timeOfEachTaskArrayIntiger[i] > 0)
- {
- taskIntigerCheker = int.Parse(task[1]);
- if (taskIntigerCheker == i)
- {
- timeOfEachTaskArrayIntiger[i] = -1;
- }
- }
- else if (task[0] == "Count" && task[1] == "Completed")
- {
- for (int j = 0; j < timeOfEachTaskArrayIntiger.Length; j++)
- {
- if (timeOfEachTaskArrayIntiger[j] == 0)
- {
- completeCounter++;
- }
- }
- Console.WriteLine(completeCounter);
- break;
- }
- else if (task[0] == "Count" && task[1] == "Incomplete")
- {
- for (int j = 0; j < timeOfEachTaskArrayIntiger.Length; j++)
- {
- if (timeOfEachTaskArrayIntiger[j] > 0)
- {
- countIncomplete++;
- }
- }
- Console.WriteLine(countIncomplete);
- break;
- }
- else if (task[0] == "Count" && task[1] == "Dropped")
- {
- for (int j = 0; j < timeOfEachTaskArrayIntiger.Length; j++)
- {
- if (timeOfEachTaskArrayIntiger[j] < 0)
- {
- dropTask++;
- }
- }
- Console.WriteLine(dropTask);
- break;
- }
- }
- }
- for (int i = 0; i < timeOfEachTaskArrayIntiger.Length; i++)
- {
- if (timeOfEachTaskArrayIntiger[i] > 0)
- {
- Console.Write($"{timeOfEachTaskArrayIntiger[i]} ");
- }
- else
- {
- continue;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement