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;
- namespace TerroristsWin_9
- {
- class TerroristsWin_9
- {
- static char[] text;
- static void PrintArray()
- {
- foreach (var ch in text)
- {
- Console.Write(ch+" ");
- }
- Console.WriteLine();
- }
- static void CalcBomb(int start, int end,int bomb)
- {
- int beginning = start - bomb;
- int finall = end + bomb;
- if (bomb == 0)
- {
- return;
- }
- if (beginning < 0)
- {
- beginning = 0;
- }
- else if (finall>(text.Length-1))
- {
- finall = text.Length - 1;
- }
- for (int i = beginning; i <= finall; i++)
- {
- text[i] = '.';
- }
- }
- static void Main(string[] args)
- {
- text = Console.ReadLine().ToCharArray();
- int bombStart = 0;
- int bombEnd = 0;
- for (int a = 0; a < text.Length; a++)
- {
- int sum = 0;
- int bombCapacity = 0;
- if (text[a].Equals('|'))
- {
- bombStart = a;
- for (int b = a + 1; b < text.Length; b++)
- {
- if (text[b].Equals('|'))
- {
- bombEnd = b;
- a = b;
- bombCapacity = sum % 10;
- CalcBomb(bombStart, bombEnd, bombCapacity);
- break;
- }
- sum += text[b];
- }
- }
- }
- PrintArray();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement