Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Numerics;
- using System.Threading;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- List<int> targets = Console.ReadLine().Split().Select(int.Parse).ToList();
- string command = Console.ReadLine();
- int count = 0;
- while (command != "End")
- {
- int hit = int.Parse(command);
- if (hit >= 0 && hit < targets.Count)
- {
- if (targets[hit] != -1)
- {
- int temp = targets[hit];
- targets[hit] = -1;
- count++;
- for (int i = 0; i < targets.Count; i++)
- {
- if (targets[i] != -1)
- {
- if (targets[i] > temp)
- {
- targets[i] -= temp;
- }
- else
- {
- targets[i] += temp;
- }
- }
- }
- }
- }
- command = Console.ReadLine();
- }
- Console.WriteLine($"Shot targets: {count} -> {string.Join(" ", targets)}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement