Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class FighterAttack
- {
- static bool isHitted = false;
- static void Main()
- {
- int Px1 = int.Parse(Console.ReadLine());
- int Py1 = int.Parse(Console.ReadLine());
- int Px2 = int.Parse(Console.ReadLine());
- int Py2 = int.Parse(Console.ReadLine());
- int Fx = int.Parse(Console.ReadLine());
- int Fy = int.Parse(Console.ReadLine());
- int distance = int.Parse(Console.ReadLine());
- distance = distance + Fx;
- int PxMin = Math.Min(Px1, Px2);
- int PxMax = Math.Max(Px1, Px2);
- int PyMin = Math.Min(Py1, Py2);
- int PyMax = Math.Max(Py1, Py2);
- for (int i = 0; i < 7; i++)
- {
- CkeckForSolution(distance, PxMin, PxMax, PyMin, PyMax, Fy);
- if (isHitted)
- {
- return;
- }
- }
- if (!isHitted)
- {
- Console.WriteLine(0 + "%");
- }
- }
- static void CkeckForSolution(int distance, int PxMin, int PxMax, int PyMin, int PyMax, int Fy)
- {
- if ((distance >= PxMin && distance <= PxMax - 1)
- && (Fy == PyMin || Fy == PyMax))
- {
- Console.WriteLine(225 + "%");
- isHitted = true;
- return;
- }
- if (distance >= PxMin && distance <= PxMax - 1
- && Fy >= PyMin - 1 && Fy <= PyMax - 1)
- {
- Console.WriteLine(275 + "%"); ;
- isHitted = true;
- return;
- }
- if ((distance <= PxMin - 1) && (Fy >= PyMin && Fy <= PyMax))
- {
- Console.WriteLine(75 + "%");
- isHitted = true;
- return;
- }
- if ((distance == PxMax) && (Fy > PyMin + 1 || Fy < PyMax - 1))
- {
- Console.WriteLine(150 + "%"); ;
- isHitted = true;
- return;
- }
- if ((distance == PxMax) && (Fy == PyMin || Fy == PyMax))
- {
- Console.WriteLine(100 + "%");
- isHitted = true;
- return;
- }
- if ((distance >= PxMin && distance <= PxMax)
- && (Fy == PyMin - 1 || Fy == PyMax + 1))
- {
- Console.WriteLine(50 + "%");
- isHitted = true;
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment