Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- string[] dim = Console.ReadLine().Split(',');
- int row = int.Parse(dim[0]);
- int col = int.Parse(dim[1]);
- int[,] battlefield = new int[row, col];
- for(int i = 0; i < row; i++)
- {
- for (int j = 0; j < col; j++)
- {
- battlefield[i, j] = 100;
- }
- }
- while (true)
- {
- string[] command = Console.ReadLine().Split(',');
- if (command[0] == "GAME OVER")
- {
- break;
- }
- int x = int.Parse(command[0]);
- int y = int.Parse(command[1]);
- int damage = int.Parse(command[2]);
- if (x < row && x >= 0 && y < col && y >= 0)
- {
- battlefield[x, y] -= damage;
- if (battlefield[x, y] < 0)
- {
- battlefield[x, y] = 0;
- }
- }
- }
- for ( int i = 0; i < row; i ++)
- {
- for (int j = 0; j < col; j++)
- {
- Console.Write(battlefield[i, j] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement