Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _2.Tasks_Planner
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- string command = Console.ReadLine();
- while (command!="End")
- {
- string[] tokens = command.Split(" ");
- if (tokens[0]== "Complete")
- {
- int index = int.Parse(tokens[1]);
- if (index>=0 && index<nums.Length)
- {
- nums[index] = 0;
- }
- }
- else if (tokens[0]== "Change")
- {
- int index = int.Parse(tokens[1]);
- int time = int.Parse(tokens[2]);
- if (index >= 0 && index < nums.Length)
- {
- nums[index] = time;
- }
- }
- else if (tokens[0] == "Drop")
- {
- int index = int.Parse(tokens[1]);
- if (index >= 0 && index < nums.Length)
- {
- nums[index] = -1;
- }
- }
- else if (command=="Count Completed")
- {
- int counter = 0;
- foreach (var num in nums)
- {
- if (num==0)
- {
- counter++;
- }
- }
- Console.WriteLine(counter);
- }
- else if (command== "Count Incomplete")
- {
- int counter = 0;
- foreach (var num in nums)
- {
- if (num > 0)
- {
- counter++;
- }
- }
- Console.WriteLine(counter);
- }
- else if (command=="Count Dropped")
- {
- int counter = 0;
- foreach (var num in nums)
- {
- if (num < 0)
- {
- counter++;
- }
- }
- Console.WriteLine(counter);
- }
- command = Console.ReadLine();
- }
- var incomplete = new List<int>();
- foreach (var num in nums)
- {
- if (num>0)
- {
- incomplete.Add(num);
- }
- }
- Console.WriteLine(string.Join(" ",incomplete));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement