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 ShipDamage
- {
- class ShipDamage
- {
- static void Main(string[] args)
- {
- int shipSX1 = int.Parse(Console.ReadLine());
- int shipSY1 = int.Parse(Console.ReadLine());
- int shipSX2 = int.Parse(Console.ReadLine());
- int shipSY2 = int.Parse(Console.ReadLine());
- int horizontH = int.Parse(Console.ReadLine());
- int attackCX1 = int.Parse(Console.ReadLine());
- int attackCY1 = int.Parse(Console.ReadLine());
- int attackCX2 = int.Parse(Console.ReadLine());
- int attackCY2 = int.Parse(Console.ReadLine());
- int attackCX3 = int.Parse(Console.ReadLine());
- int attackCY3 = int.Parse(Console.ReadLine());
- shipSY1 -= horizontH;
- shipSY2 -= horizontH;
- attackCY1 -= horizontH;
- attackCY2 -= horizontH;
- attackCY3 -= horizontH;
- int reflectAttackCY1 = -attackCY1;
- int reflectAttackCY2 = -attackCY2;
- int reflectAttackCY3 = -attackCY3;
- int shipTop = Math.Max(shipSY1,shipSY2);
- int shipLeft = Math.Min(shipSX1,shipSX2);
- int shipRight = Math.Max(shipSX1, shipSX2);
- int shipBottom = Math.Min(shipSY1, shipSY2);
- int damage = 0;
- if (reflectAttackCY1 > shipBottom && reflectAttackCY1 < shipTop)
- {
- if (attackCX1 > shipLeft && attackCX1 < shipRight)
- {
- damage += 100;
- }
- else if (attackCX1 == shipLeft || attackCX1 == shipRight)
- {
- damage += 50;
- }
- }
- if (reflectAttackCY1 == shipTop || reflectAttackCY1 == shipBottom)
- {
- if (attackCX1 > shipLeft && attackCX1 < shipRight)
- {
- damage += 50;
- }
- else if (attackCX1 == shipLeft || attackCX1 == shipRight)
- {
- damage += 25;
- }
- }
- if (reflectAttackCY2 > shipBottom && reflectAttackCY2 < shipTop)
- {
- if (attackCX2 > shipLeft && attackCX2 < shipRight)
- {
- damage += 100;
- }
- else if (attackCX2 == shipLeft || attackCX2 == shipRight)
- {
- damage += 50;
- }
- }
- if (reflectAttackCY2 == shipTop || reflectAttackCY2 == shipBottom)
- {
- if (attackCX2 > shipLeft && attackCX2 < shipRight)
- {
- damage += 50;
- }
- else if (attackCX2== shipLeft || attackCX2 == shipRight)
- {
- damage += 25;
- }
- }
- if (reflectAttackCY3 > shipBottom && reflectAttackCY3 < shipTop)
- {
- if (attackCX3 > shipLeft && attackCX3 < shipRight)
- {
- damage += 100;
- }
- else if (attackCX3 == shipLeft || attackCX3 == shipRight)
- {
- damage += 50;
- }
- }
- if (reflectAttackCY3 == shipTop || reflectAttackCY3 == shipBottom)
- {
- if (attackCX3 > shipLeft && attackCX3 < shipRight)
- {
- damage += 50;
- }
- else if (attackCX3 == shipLeft || attackCX3 == shipRight)
- {
- damage += 25;
- }
- }
- Console.WriteLine(damage + "%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment