Statistics

Problem Statement for "NextOlympics"

Problem Statement

Tokyo Olympics 2021 is scheduled to start from the opening ceremony in July 23rd, 2021.


Suzuki, a man who lives in Japan, is looking forward to seeing the opening ceremony.
Now, he wants to calculate how many days are remaining to the opening ceremony. (For example, if the opening ceremony were tomorrow, there would be 1 day remaining.)


Today's date is given as a string today in the format "YYYY.MM.DD". Day and month numbers have an extra leading zero if necessary. Some examples:

  • If today's date is July 24th, 2020, today will be "2020.07.24".
  • If today's date is November 9th, 2020, today will be "2020.11.09".
  • If today's date is February 25th, 2021, today will be "2021.02.25".


For Suzuki, calculate and return how many days are remaining to the opening ceremony of Tokyo Olympics 2021.

Definition

Class:
NextOlympics
Method:
countDays
Parameters:
String
Returns:
int
Method signature:
int countDays(String today)
(be sure your method is public)

Notes

  • In this problem, you will implement the class "NextOlympics" with a public function named "countDays" which takes a string today as a parameter and returns an integer value.
  • If you do not know about how to compete or how to write/compile/test/submit solutions, please refer to https://www.topcoder.com/community/competitive-programming/how-to-compete for detailed information about competing in SRM.
  • And, don't forget testing at least on the example cases! In Applet Arena, you can test all example cases at once using "Batch Test". In Web Arena, you can test all example cases by checking all of them in the Test Panel.
  • For testing on custom cases or attempting challenges in the Challenge Phase, the string you input should be enclosed in double quotes (""). For example, you can input "2020.07.24" including the quotes.

Constraints

  • The string today will represent a valid date (in Gregorian Calendar) from July 24th 2020 to July 23rd 2021, inclusive.

Examples

  1. "2020.07.24"

    Returns: 364

    TopCoder SRM 788 is taking place in July 24th, 2020. Here, Tokyo Olympics 2021 is less than one year from now! Given this, 364 days are remaining to the opening ceremony of the Olympics. By the way, July 24th, 2020 is a holiday in Japan called "Sports Day". It's a holiday to celebrate the Olympics.

  2. "2020.11.09"

    Returns: 256

    In this example, "today" is November 9th, 2020. Here, 256 days are remaining until the Olympics begin. So, you should return 256 for this example. Suzuki has to wait 256 days for the opening ceremony.

  3. "2021.02.25"

    Returns: 148

    In this example, "today" is February 25th, 2021. Here, 148 days are remaining until the opening ceremony. Suzuki has to wait 148 days for the opening ceremony.

  4. "2021.07.23"

    Returns: 0

    In this example, "today" is July 23rd, 2021. It's the day of the opening ceremony of the Tokyo Olympics 2021. For this case, since there are 0 days remaining to the opening ceremony, you should return 0.

  5. "2020.12.31"

    Returns: 204

    In this example, "today" is December 31st, 2020. There are 204 days remaining to the opening ceremony.

  6. "2021.01.01"

    Returns: 203

    In this example, "today" is January 1st, 2021. There are 203 days remaining to the opening ceremony.

  7. "2021.02.01"

    Returns: 172

  8. "2021.03.01"

    Returns: 144

  9. "2021.04.01"

    Returns: 113

  10. "2021.05.01"

    Returns: 83

  11. "2021.06.01"

    Returns: 52

  12. "2021.07.01"

    Returns: 22

  13. "2020.08.01"

    Returns: 356

  14. "2020.09.01"

    Returns: 325

  15. "2020.10.01"

    Returns: 295

  16. "2020.11.01"

    Returns: 264

  17. "2020.12.01"

    Returns: 234

  18. "2021.01.31"

    Returns: 173

  19. "2021.02.28"

    Returns: 145

  20. "2021.03.31"

    Returns: 114

  21. "2021.04.30"

    Returns: 84

  22. "2021.05.31"

    Returns: 53

  23. "2021.06.30"

    Returns: 23

  24. "2020.07.31"

    Returns: 357

  25. "2020.08.31"

    Returns: 326

  26. "2020.09.30"

    Returns: 296

  27. "2020.10.31"

    Returns: 265

  28. "2020.11.30"

    Returns: 235

  29. "2021.01.12"

    Returns: 192

  30. "2021.02.12"

    Returns: 161

  31. "2021.03.03"

    Returns: 142

  32. "2021.04.11"

    Returns: 103

  33. "2021.05.30"

    Returns: 54

  34. "2021.06.21"

    Returns: 32

  35. "2021.07.04"

    Returns: 19

  36. "2020.08.15"

    Returns: 342

  37. "2020.09.23"

    Returns: 303

  38. "2020.10.20"

    Returns: 276

  39. "2020.11.05"

    Returns: 260

  40. "2020.12.11"

    Returns: 224

  41. "2021.03.15"

    Returns: 130


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: