Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Gift_Box_Coverage
- {
- class Program
- {
- static void Main()
- {
- List<int> tasks = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToList();
- while (true)
- {
- string input = Console.ReadLine();
- string[] cmdArgs = input.Split();
- string command = cmdArgs[0];
- if (command== "Complete")
- {
- int index = int.Parse(cmdArgs[1]);
- int indexCheck = tasks.Count();
- if (indexCheck>=0 && index < tasks.Count())
- {
- tasks.RemoveAt(index);
- tasks.Insert(index, 0);
- }
- }
- else if (command=="Change")
- {
- int indexCheck = tasks.Count();
- int index = int.Parse(cmdArgs[1]);
- int time = int.Parse(cmdArgs[2]);
- if (indexCheck >= 0 && index < tasks.Count)
- {
- tasks.RemoveAt(index);
- tasks.Insert(index, time);
- }
- }
- else if (command=="Drop")
- {
- int indexCheck = tasks.Count();
- int index = int.Parse(cmdArgs[1]);
- if (indexCheck >= 0 && index < tasks.Count)
- {
- tasks.RemoveAt(index);
- tasks.Insert(index, -1);
- }
- }
- else if (command=="Count")
- {
- string secondCommand = cmdArgs[1];
- if (secondCommand=="Complete")
- {
- var listB = tasks.FindAll(x => x == 0);
- int countOfCompleted = listB.Count();
- Console.WriteLine(string.Join("", countOfCompleted));
- }
- else if (secondCommand== "Incomplete")
- {
- var listC = tasks.FindAll(x => x > 0);
- int countOfIncomplete = listC.Count();
- Console.WriteLine(string.Join("", countOfIncomplete));
- }
- else if (secondCommand== "Dropped")
- {
- var listD = tasks.FindAll(x => x == -1);
- int countOfDropped = listD.Count();
- Console.WriteLine(string.Join("", countOfDropped));
- }
- }
- else if (command=="End")
- {
- var Incomplete = tasks.FindAll(x => x > 0);
- Console.WriteLine(string.Join(" ", Incomplete));
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement