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;
- namespace _1.Problem_FighterAttack
- {
- class Program
- {
- 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 D = int.Parse(Console.ReadLine());
- double damage = 0;
- int newFx = Fx + D;
- //100% hit
- if ((newFx <= Math.Max(Px1, Px2) && newFx >= Math.Min(Px1, Px2) && Fy <= Math.Max(Py1, Py2) && Fy >= Math.Min(Py1, Py2)))
- {
- damage = damage + 1;
- }
- //Up 50% hit
- if ((newFx <= Math.Max(Px1, Px2) && newFx >= Math.Min(Px1, Px2) && Fy + 1 <= Math.Max(Py1, Py2) && Fy + 1 >= Math.Min(Py1, Py2)))
- {
- damage = damage + 0.5;
- }
- //Down 50% hit
- if ((newFx <= Math.Max(Px1, Px2) && newFx >= Math.Min(Px1, Px2) && Fy - 1 <= Math.Max(Py1, Py2) && Fy - 1 >= Math.Min(Py1, Py2)))
- {
- damage = damage + 0.5;
- }
- //Front 75% hit
- if ((newFx + 1 <= Math.Max(Px1, Px2) && newFx + 1 >= Math.Min(Px1, Px2) && Fy <= Math.Max(Py1, Py2) && Fy >= Math.Min(Py1, Py2)))
- {
- damage = damage + 0.75;
- }
- Console.WriteLine("{0:0%}", damage);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement