コード例 #1
0
    static void Main()
    {
        Plant thePlant = new Plant( int.Parse(Console.ReadLine()), // reads the plant's coordinates: Px1,
                                    int.Parse(Console.ReadLine()), // Py1,
                                    int.Parse(Console.ReadLine()), // Px2,
                                    int.Parse(Console.ReadLine())  // Py2 (and sort them!)
                               );

        int Fx = int.Parse(Console.ReadLine()); // reads the x coordinate of a fighter
        int Fy = int.Parse(Console.ReadLine()); // reads the y coordinate of a fighter
        int Dist = int.Parse(Console.ReadLine()); // reads the missale distance
        int damage = 0;

        damage += (thePlant.Damage(Fx + Dist, Fy)) ? 100 : 0; // if missle's main target is inside the plant - 100% damage
        damage += (thePlant.Damage(Fx + Dist, Fy - 1)) ? 50 : 0; // if missle's target to the left of main is inside the plant - 50% damage
        damage += (thePlant.Damage(Fx + Dist, Fy + 1)) ? 50 : 0; // if missle's target to the right of main is inside the plant  - 50% damage
        damage += (thePlant.Damage(Fx + Dist + 1, Fy)) ? 75 : 0; // if missle's target one cell forward of main is inside the plant  - 75% damage

        Console.WriteLine("{0}%", damage);
    }