Statistics

Problem Statement for "CellularPhoneTarif"

Problem Statement

You have spoken seconds seconds by phone and you'd like to calculate the cost of the call. Starting a call always costs you 5 cents, regardless of the call's duration. Additionally, you need to pay for every minute you've been talking. Any fractional minute is charged at full price, so if you've talked for 65 seconds, you'll be charged for 2 minutes. Also, the timer for a new minute starts when your 60-th, 120-th, 180-th, ... second ends (if you talk for 120 seconds, you'll be charged for 3 minutes).

The payment for the call itself is a bit complicated. During the first 5 minutes of the call, you must pay 10 cents for each minute that you've talked. After the first 5 minutes of the call, each additional minute will cost you only 3 cents. Given the duration of your call in seconds, return the cost of the call.

Definition

Class:
CellularPhoneTarif
Method:
calculatePrice
Parameters:
int
Returns:
int
Method signature:
int calculatePrice(int seconds)
(be sure your method is public)

Constraints

  • seconds will be between 0 and 10000, inclusive.

Examples

  1. 65

    Returns: 25

  2. 300

    Returns: 58

  3. 100

    Returns: 25

  4. 0

    Returns: 15

  5. 10000

    Returns: 541

  6. 313

    Returns: 58

  7. 58

    Returns: 15

  8. 2

    Returns: 15

  9. 2933

    Returns: 187

  10. 121

    Returns: 35

  11. 302

    Returns: 58

  12. 118

    Returns: 25

  13. 239

    Returns: 45

  14. 180

    Returns: 45

  15. 8744

    Returns: 478

  16. 602

    Returns: 73

  17. 722

    Returns: 79

  18. 1410

    Returns: 112

  19. 5008

    Returns: 292

  20. 5929

    Returns: 337

  21. 7745

    Returns: 430

  22. 841

    Returns: 85

  23. 241

    Returns: 55

  24. 1201

    Returns: 103

  25. 301

    Returns: 58

  26. 61

    Returns: 25

  27. 1260

    Returns: 106

  28. 1381

    Returns: 112

  29. 1

    Returns: 15

  30. 1201

    Returns: 103

  31. 1436

    Returns: 112

  32. 1320

    Returns: 109

  33. 1199

    Returns: 100

  34. 6289

    Returns: 355

  35. 1678

    Returns: 124

  36. 1022

    Returns: 94

  37. 1570

    Returns: 121

  38. 360

    Returns: 61

  39. 598

    Returns: 70

  40. 1621

    Returns: 124

  41. 763

    Returns: 79

  42. 1065

    Returns: 94

  43. 1919

    Returns: 136

  44. 1021

    Returns: 94

  45. 842

    Returns: 85

  46. 358

    Returns: 58

  47. 602

    Returns: 73

  48. 6730

    Returns: 379

  49. 1559

    Returns: 118

  50. 2339

    Returns: 157

  51. 1861

    Returns: 136

  52. 900

    Returns: 88

  53. 301

    Returns: 58

  54. 240

    Returns: 55

  55. 0

    Returns: 15

  56. 59

    Returns: 15


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: