Statistics

Problem Statement for "FightMonsterDiv2"

Problem Statement

Hero is fighting against a monster.

Hero's basic attack deals attack points of damage. Hero also has a special skill that gradually increases the amount of damage he deals when attacking the same monster multiple times in a row. Hero has level skill points in this skill. The effect of the skill is such that in each of the following attacks the damage is increased by level percent of the damage dealt by the basic attack. In other words, if Hero already attacked the monster n times, the next attack after that will deal attack + n * (level percent of attack) damage.

Hero is going to attack the monster duration times in a row. Calculate and return the total amount of damage he will deal.

Definition

Class:
FightMonsterDiv2
Method:
damageDealt
Parameters:
long, long, long
Returns:
long
Method signature:
long damageDealt(long attack, long level, long duration)
(be sure your method is public)

Constraints

  • attack will be between 100 and 100,000, inclusive.
  • attack will be a multiple of 100.
  • level will be between 0 and 100, inclusive.
  • duration will be between 1 and 100,000, inclusive.

Examples

  1. 100

    10

    3

    Returns: 330

    The first attack will deal 100 damage. The second attack will deal 100 + 10 = 110 damage. The third attack will deal 110 + 10 = 120 damage.

  2. 100

    0

    5

    Returns: 500

    With level = 0, the increment is zero and thus each of the five attacks will deal 100 damage.

  3. 100000

    100

    100000

    Returns: 500005000000000

    This is the largest possible input. Watch out for integer overflow.

  4. 100

    0

    1

    Returns: 100

  5. 100

    100

    1

    Returns: 100

  6. 100

    100

    100000

    Returns: 500005000000

  7. 100000

    0

    100000

    Returns: 10000000000

  8. 5200

    10

    11

    Returns: 85800

  9. 3000

    7

    12

    Returns: 49860

  10. 4600

    8

    14

    Returns: 97888

  11. 900

    9

    20

    Returns: 33390

  12. 100

    6

    11

    Returns: 1430

  13. 79200

    55

    50839

    Returns: 56295592574760

  14. 33400

    97

    95641

    Returns: 148177152192160

  15. 64300

    59

    57602

    Returns: 62939912163337

  16. 75200

    49

    58010

    Returns: 62003003258160

  17. 64200

    85

    85850

    Returns: 201099690065250

  18. 200

    10

    2

    Returns: 420

  19. 200

    1

    2

    Returns: 402

  20. 200

    3

    2

    Returns: 406

  21. 200

    10

    3

    Returns: 660

  22. 400

    2

    1000

    Returns: 4396000

  23. 300

    5

    10

    Returns: 3675

  24. 500

    5

    3

    Returns: 1575


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: