Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PaintBall
- {
- class PaintBall
- {
- static void Main()
- {
- int[,] field = new int[10,10];
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- field[i, j] = 1;
- }
- }
- int currentPaint = 0;
- string inputLine = Console.ReadLine();
- while (inputLine != "End")
- {
- string[] inputSplit = inputLine.Split(' ');
- int row = Convert.ToInt32(inputSplit[0]);
- int col = Convert.ToInt32(inputSplit[1]);
- int radius = Convert.ToInt32(inputSplit[2]);
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- if (i >= row - radius && j >= col - radius && i <= row + radius && j <= col + radius)
- {
- field[i, j] = currentPaint;
- }
- }
- }
- if (currentPaint == 0)
- {
- currentPaint = 1;
- }
- else
- {
- currentPaint = 0;
- }
- inputLine = Console.ReadLine();
- }
- int sum = 0;
- for (int i = 0; i < 10; i++)
- {
- string current = "";
- for (int j = 0; j < 10; j++)
- {
- current += field[i, j];
- }
- current = ReverseString(current);
- sum += Convert.ToInt32(current, 2);
- }
- Console.WriteLine(sum);
- }
- public static string ReverseString(string s)
- {
- char[] arr = s.ToCharArray();
- Array.Reverse(arr);
- return new string(arr);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment