Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _09_Terrorists_Win
- {
- internal class Program
- {
- private static void Main()
- {
- string input = Console.ReadLine();
- char[] inputArray = input.ToCharArray();
- for (int i = 0; i < input.Length; i++)
- {
- int iStart = i;
- string bomb = "";
- if (input[i] == '|')
- {
- while (input[i + 1] != '|')
- {
- bomb += input[i + 1];
- i++;
- }
- i += bomb.Length + 1;
- int explodeRadius = GetAsciiValue(bomb);
- for (int j = iStart-explodeRadius; j <= iStart+bomb.Length+1+explodeRadius; j++)
- {
- inputArray[j] = '.';
- }
- }
- }
- foreach (var a in inputArray)
- {
- Console.Write(a);
- }
- }
- private static int GetAsciiValue(string input)
- {
- int explodeRadius = 0;
- for (int i = 0; i < input.Length; i++)
- {
- explodeRadius += (int) input[i];
- }
- string tmpRadius = explodeRadius.ToString();
- explodeRadius = int.Parse(tmpRadius.Last().ToString());
- return explodeRadius;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement