Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CoordinateShipDamage
- {
- static void Main()
- {
- int sx1 = int.Parse(Console.ReadLine());
- int sy1 = int.Parse(Console.ReadLine());
- int sx2 = int.Parse(Console.ReadLine());
- int sy2 = int.Parse(Console.ReadLine());
- int h = int.Parse(Console.ReadLine());
- int cx1 = int.Parse(Console.ReadLine());
- int cy1 = int.Parse(Console.ReadLine());
- int cx2 = int.Parse(Console.ReadLine());
- int cy2 = int.Parse(Console.ReadLine());
- int cx3 = int.Parse(Console.ReadLine());
- int cy3 = int.Parse(Console.ReadLine());
- int bombResult = 0;
- // ========================================= bombs coordinates
- // === bomb 1
- int bombC1y = 0;
- int bombC1x = cx1;
- if (cx1 != h)
- {
- bombC1y = h + h - cy1;
- }
- else if (cx1 == h)
- {
- bombC1y = cy1;
- }
- //===== bomb 2
- int bombC2y = 0;
- int bombC2x = cx2;
- if (cx2 != h)
- {
- bombC2y = h + h - cy2;
- }
- else if (cx2 == h)
- {
- bombC2y = cy2;
- }
- //===== bomb 2
- int bombC3y = 0;
- int bombC3x = cx3;
- if (cx3 != h)
- {
- bombC3y = h + h - cy3;
- }
- else if (cx3 == h)
- {
- bombC3y = cy3;
- }
- // =========================================== coordinates if the rectalgular
- // sx1
- // sy1
- int sx1a = sx1;
- int sy1a = sy2;
- // sx2
- // sy2
- int sx2a = sx2;
- int sy2a = sy1;
- // ============================================ if hitted
- // bomb 1
- if (((sx1 < bombC1x && bombC1x < sx2) && (sy2 < bombC1y && bombC1y < sy1)) || ((sx1 > bombC1x && bombC1x > sx2) && (sy2 < bombC1y && bombC1y < sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 < bombC1x && bombC1x < sx2) && (sy2 > bombC1y && bombC1y > sy1)) || ((sx1 > bombC1x && bombC1x > sx2) && (sy2 > bombC1y && bombC1y > sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 == bombC1x || bombC1x == sx2) && (sy2 < bombC1y && bombC1y < sy1)) ||(sy2 > bombC1y && bombC1y > sy1))
- {
- bombResult += 50;
- }
- else if (((sx1 < bombC1x && bombC1x < sx2) && (sy2 == bombC1y || bombC1y == sy1)) || ((sx1 > bombC1x && bombC1x > sx2) && (sy2 == bombC1y || bombC1y == sy1)))
- {
- bombResult += 50;
- }
- else if ((sx1 == bombC1x && sy1 == bombC1y) || (sx2 == bombC1x && sy2 == bombC1y) || (sx1a == bombC1x && sy1a == bombC1y) || (sx2a == bombC1x && sy2a == bombC1y))
- {
- bombResult += 25;
- }
- else
- {
- bombResult += 0;
- }
- // bomb 2
- if (((sx1 < bombC2x && bombC2x < sx2) && (sy2 < bombC2y && bombC2y < sy1)) || ((sx1 > bombC2x && bombC2x > sx2) && (sy2 < bombC2y && bombC2y < sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 < bombC2x && bombC2x < sx2) && (sy2 > bombC2y && bombC2y > sy1)) || ((sx1 > bombC2x && bombC2x > sx2) && (sy2 > bombC2y && bombC2y > sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 == bombC2x || bombC2x == sx2) && (sy2 < bombC2y && bombC2y < sy1)) || (sy2 > bombC2y && bombC2y > sy1))
- {
- bombResult += 50;
- }
- else if (((sx1 < bombC2x && bombC2x < sx2) && (sy2 == bombC2y || bombC2y == sy1)) || ((sx1 > bombC2x && bombC2x > sx2) && (sy2 == bombC2y || bombC2y == sy1)))
- {
- bombResult += 50;
- }
- else if ((sx1 == bombC2x && sy1 == bombC2y) || (sx2 == bombC2x && sy2 == bombC2y) || (sx1a == bombC2x && sy1a == bombC2y) || (sx2a == bombC2x && sy2a == bombC2y))
- {
- bombResult += 25;
- }
- else
- {
- bombResult += 0;
- }
- // bomb 3
- if (((sx1 < bombC3x && bombC3x < sx2) && (sy2 < bombC3y && bombC3y < sy1)) || ((sx1 > bombC3x && bombC3x > sx2) && (sy2 < bombC3y && bombC3y < sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 < bombC3x && bombC3x < sx2) && (sy2 > bombC3y && bombC3y > sy1)) || ((sx1 > bombC3x && bombC3x > sx2) && (sy2 > bombC3y && bombC3y > sy1)))
- {
- bombResult += 100;
- }
- else if (((sx1 == bombC3x || bombC3x == sx2) && (sy2 < bombC3y && bombC3y < sy1)) || (sy2 > bombC3y && bombC3y > sy1))
- {
- bombResult += 50;
- }
- else if (((sx1 < bombC3x && bombC3x < sx2) && (sy2 == bombC3y || bombC3y == sy1)) || ((sx1 > bombC3x && bombC3x > sx2) && (sy2 == bombC3y || bombC3y == sy1)))
- {
- bombResult += 50;
- }
- else if ((sx1 == bombC3x && sy1 == bombC3y) || (sx2 == bombC3x && sy2 == bombC3y) || (sx1a == bombC3x && sy1a == bombC3y) || (sx2a == bombC3x && sy2a == bombC3y))
- {
- bombResult += 25;
- }
- else
- {
- bombResult += 0;
- }
- // result
- Console.WriteLine("{0}%", bombResult);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement