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 Lasers
- {
- class Program
- {
- static string[] cuboids = Console.ReadLine().Split();
- static int width = int.Parse(cuboids[0]);
- static int height = int.Parse(cuboids[1]);
- static int depth = int.Parse(cuboids[2]);
- static string[] lasers = Console.ReadLine().Split();
- static int laserWidth = int.Parse(lasers[0]);
- static int laserHeight = int.Parse(lasers[1]);
- static int laserDepth = int.Parse(lasers[2]);
- static string[] vectors = Console.ReadLine().Split();
- static int dirWidth = int.Parse(vectors[0]);
- static int dirHeight = int.Parse(vectors[1]);
- static int dirDepth = int.Parse(vectors[2]);
- static bool[, ,] matrix = new bool[width, height, depth];
- static void Main(string[] args)
- {
- DeleteEdjes();
- bool opa;
- int oldWidth = 0;
- int oldHeight = 0;
- int oldDepth = 0;
- while (true)
- {
- CheckForWall(laserWidth,laserHeight,laserDepth);
- if (matrix[laserWidth,laserHeight,laserDepth] == true)
- {
- break;
- }
- oldWidth = laserWidth;
- oldHeight = laserHeight;
- oldDepth = laserDepth;
- matrix[laserWidth, laserHeight, laserDepth] = true;
- laserWidth += dirWidth;
- laserHeight += dirHeight;
- laserDepth += dirDepth;
- }
- Console.WriteLine("{0} {1} {2}",oldWidth,oldHeight,oldDepth);
- }
- static void CheckForWall(int laserWidth, int laserHeight, int laserDepth)
- {
- if (laserWidth == width - 1 || laserWidth == 0)
- {
- dirWidth *= -1;
- }
- if (laserHeight == height -1 || laserHeight == 0)
- {
- dirHeight *= -1;
- }
- if (laserDepth == depth - 1 || laserDepth == 0)
- {
- dirDepth *= -1;
- }
- }
- static void DeleteEdjes()
- {
- int curWidth = 0;
- int curHeight = 0;
- int curDepth = 0;
- for (int i = 0; i < height; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curHeight++;
- }
- curHeight = 0;
- for (int i = 1; i < width; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curWidth++;
- }
- curWidth = 0;
- for (int i = 1; i < depth; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curDepth++;
- }
- curDepth = depth - 1;
- for (int i = 1; i < width; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curWidth++;
- }
- curDepth = 0;
- for (int i = 1; i < depth; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curDepth++;
- }
- curWidth = width-1;
- curHeight = 0;
- curDepth = 0;
- for (int i = 1; i < height; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curHeight++;
- }
- curHeight = 0;
- curDepth = depth-1;
- for (int i = 1; i < height; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curHeight++;
- }
- curWidth = 0;
- curHeight = 0;
- for (int i = 1; i < height; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curHeight++;
- }
- curWidth = 0;
- curHeight = height-1;
- curDepth = 0;
- for (int i = 1; i < width; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curWidth++;
- }
- curWidth = 0;
- curDepth = 0;
- for (int i = 1; i < depth; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curDepth++;
- }
- curWidth = width-1;
- curDepth = 0;
- for (int i = 1; i < depth; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curDepth++;
- }
- curWidth = 0;
- curDepth = depth-1;
- for (int i = 1; i < width; i++)
- {
- matrix[curWidth, curHeight, curDepth] = true;
- curWidth++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement