Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace _03.Exact_Sum_of_Real_Numbers
- {
- class Program
- {
- static void Main()
- {
- List<double> numbers = Console.ReadLine()
- .Split()
- .Select(double.Parse)
- .ToList();
- while (true)
- {
- string line = Console.ReadLine();
- string[] tokens = line.Split();
- switch (tokens[0])
- {
- case "Complete":
- int indexToComplete = int.Parse(tokens[1]);
- int completeIndexCheck = numbers.Count();
- if (0 <= indexToComplete && indexToComplete < numbers.Count)
- {
- numbers.RemoveAt(indexToComplete);
- numbers.Insert(indexToComplete, 0);
- }
- else
- {
- }
- break;
- case "Change":
- int changeIndexCheck = numbers.Count();
- int indexToChange = int.Parse(tokens[1]);
- int timeToChange = int.Parse(tokens[2]);
- if (0 <= indexToChange && indexToChange < numbers.Count)
- {
- numbers.RemoveAt(indexToChange);
- numbers.Insert(indexToChange, timeToChange);
- }
- else
- {
- }
- break;
- case "Drop":
- int droppedIndexCheck = numbers.Count();
- int indexToDrop = int.Parse(tokens[1]);
- if (0 <= indexToDrop && indexToDrop < numbers.Count)
- {
- numbers.RemoveAt(indexToDrop);
- numbers.Insert(indexToDrop, -1);
- }
- else
- {
- }
- break;
- }
- if (tokens[0] == "Count" && tokens[1] == "Completed")
- {
- var listB = numbers.FindAll(x => x == 0);
- int countOfCompleted = listB.Count();
- Console.WriteLine(string.Join("", countOfCompleted));
- }
- else if (tokens[0] == "Count" && tokens[1] == "Incomplete")
- {
- var listC = numbers.FindAll(x => x > 0);
- int countOfIncomplete = listC.Count();
- Console.WriteLine(string.Join("", countOfIncomplete));
- }
- else if (tokens[0] == "Count" && tokens[1] == "Dropped")
- {
- var listD = numbers.FindAll(x => x == -1);
- int countOfDropped = listD.Count();
- Console.WriteLine(string.Join("", countOfDropped));
- }
- else if (tokens[0] == "End")
- {
- var Incomplete = numbers.FindAll(x => x > 0);
- Console.WriteLine(string.Join(" ", Incomplete));
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement