A. Time Machine

Codeforces
IDCF10275A
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
One day, Nobita decided he wanted to go to the future to see who he would be getting married to. Unfortunately, his time machine broke and it sent him to a year that he did not want to go to! Fortunately, Doraemon gave him a couple of gadgets in case something like this happened. He has an inflatable shelter (very high tech, even has an elevator), and a watch that always tells the correct time. Turns out, the time machine is a little awry but should be good to use by tomorrow. Once Nobita sets up his shelter and gets ready to sleep and wait for the time machine to fix itself, he checks his watch and notes that it's February 28th. He is suddenly curious now if tomorrow is February 29th or March 1st on the Gregorian Calendar. Given the year that his watch displays, determine tomorrow's date! Remember that a leap year occurs when a year is divisible by 400, or it is divisible by 4 but not 100. The first line of the input contains $n (1 <= n <= 100)$, the number of times Nobita traveled into the past. Then, the following $n$ lines each contain an integer $y (1 <= y <= 10000)$, a year that Nobita travels to. For each of the $n$ years that Nobita traveled to, output either _February 29_ or _March 1_ depending on if the year is a leap year or not. ## Input The first line of the input contains $n (1 <= n <= 100)$, the number of times Nobita traveled into the past. Then, the following $n$ lines each contain an integer $y (1 <= y <= 10000)$, a year that Nobita travels to. ## Output For each of the $n$ years that Nobita traveled to, output either _February 29_ or _March 1_ depending on if the year is a leap year or not. [samples]
**Definitions** Let $ n \in \mathbb{Z} $ be the number of test cases. For each $ i \in \{1, \dots, n\} $, let $ y_i \in \mathbb{Z} $ denote the year. **Constraints** 1. $ 1 \leq n \leq 100 $ 2. $ 1 \leq y_i \leq 10000 $ for all $ i \in \{1, \dots, n\} $ **Objective** For each year $ y_i $, determine tomorrow's date after February 28: - If $ y_i $ is a leap year, output "February 29". - Otherwise, output "March 1". A year $ y_i $ is a leap year if and only if: $$ (y_i \bmod 400 = 0) \lor \left( (y_i \bmod 4 = 0) \land (y_i \bmod 100 \neq 0) \right) $$
API Response (JSON)
{
  "problem": {
    "name": "A. Time Machine",
    "description": {
      "content": "One day, Nobita decided he wanted to go to the future to see who he would be getting married to. Unfortunately, his time machine broke and it sent him to a year that he did not want to go to! Fortuna",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10275A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "One day, Nobita decided he wanted to go to the future to see who he would be getting married to. Unfortunately, his time machine broke and it sent him to a year that he did not want to go to!\n\nFortuna...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of test cases.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ y_i \\in \\mathbb{Z} $ denote the year.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 100 $  \n...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments