CCC '15 J1 - Special Day

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2015 Stage 1, Junior #1

February 18 is a special date for the CCC this year.

Write a program that asks the user for a numerical month and numerical day of the month and then determines whether that date occurs before, after, or on February 18.

  • If the date occurs before February 18, output the word Before.
  • If the date occurs after February 18, output the word After.
  • If the date is February 18, output the word Special.

Input Specification

The input consists of two integers each on a separate line. These integers represent a date in 2015.

The first line will contain the month, which will be an integer in the range from 1 (indicating January) to 12 (indicating December).

The second line will contain the day of the month, which will be an integer in the range from 1 to 31. You can assume that the day of the month will be valid for the given month.

Output Specification

Exactly one of Before, After, or Special will be printed on one line.

Sample Input 1

1
7

Output for Sample Input 1

Before

Sample Input 2

8
31

Output for Sample Input 2

After

Sample Input 3

2
18

Output for Sample Input 3

Special

Comments


  • 0
    Ruard000000000000  commented on March 15, 2024, 12:51 p.m.

    I didn't capitalize the words and got zero points.

    Een verschrikkelijke computer programma.


  • 0
    AsherEdelmanCCGS  commented on Feb. 25, 2024, 2:51 a.m.

    month = int(input('')) date = int(input('')) if month <= 2 and date < 18: print('Before') elif month == 2 and date == 18 or date > 31: print('Special') else: print('After')

    isnt working on some test cases for some reason, even though it doesnt seem to have any errors (when i enter a date before, e.g. 16st of feb it gives before and same with after and special)


    • 0
      Frank_Spoon  commented on April 5, 2024, 8:28 a.m.

      month = int(input('')) date = int(input('')) if month <= 2 and date < 18: print('Before') elif month == 2 and date == 18 or date > 31: print('Special') else: print('After')

      don't think you need this bit or date > 31


  • 0
    R_G  commented on Feb. 3, 2024, 4:11 p.m.

    Excuse me. Everything except test-case four is working. When I run my code, it works fine. May someone please tell me what is going on?

    n = int(input()) n1 = int(input())

    if n == 2 and n1 == 18: print("Special") elif n < 2 and n1 <= 18 or n <= 2 and n1 < 18 or n < 2 and n1 < 18: print("Before") elif n > 2 and n1 <= 18 or n >= 2 and n1 > 18 or n > 2 and n1 > 18: print("After")


    • 1
      htoshiro  commented on Feb. 4, 2024, 2:04 a.m.

      try 1 29


      • 0
        R_G  commented on Feb. 4, 2024, 1:45 p.m. edited

        Wait! Now everything works except test-case 7!

        n = int(input()) n1 = int(input())

        if n == 2 and n1 == 18: print("Special") elif n < 2 and n1 <= 18 or n <= 2 and n1 < 18 or n < 2 and n1 < 18 or n <= 2 and n1 > 18 or n < 2 and n1 >= 18 or n < 2 and n1 > 18: print("Before") elif n > 2 and n1 <= 18 or n >= 2 and n1 > 18 or n > 2 and n1 > 18 or n >= 2 and n1 < 18 or n > 2 and n1 >=18 or n > 2 and n1 < 18: print("After")

        EDIT("FIGURED IT OUT")


        • 0
          曲意  commented on April 3, 2024, 10:05 a.m.

          Read the solution :" consider the month before the day ."

          Just like this:

          month = int(input()) day = int(input())

          if month < 2: print("Before") elif month == 2: if day < 18: print("Before") elif day == 18: print("Special") else: print("After") else: print("After")


  • 0
    JoJo_Cubano_13  commented on Dec. 30, 2023, 9:20 p.m.

    What's wrong with my solution? It should work


  • 0
    Demuzan  commented on Jan. 20, 2023, 12:49 p.m.

    Hmm i just name error, im sure i spelled correctly.


    • -1
      HAILEYISCOOL  commented on Oct. 26, 2023, 8:48 p.m.

      yes, same thing. I put the first letter capsized too. I really don't get what the problem is.


      • 0
        Mystical  commented on Oct. 27, 2023, 7:35 p.m.

        A NameError in Python occurs when you attempt to use a variable that hasn't been declared yet. In your submission, Feb was never declared anywhere.


  • 0
    tyball14  commented on Sept. 19, 2022, 7:58 a.m. edit 2

    I passed all except case #6. I think it is because I am not able to get the "Special" output. I am sure I am missing something obvious.

    Edit: I figured it out!


  • 7
    Skippin  commented on Jan. 31, 2022, 10:47 p.m.

    took me a lot longer than i thought it would. Make sure to include the instance where the month is feb and the day is less than the 18th and when it is feb and higher than 18th.


  • 1
    csk111165  commented on Aug. 20, 2021, 1:14 p.m.

    WE need to handle the case for the feb month as well, before and after..


  • -1
    HARRIBO  commented on Aug. 23, 2019, 5:25 a.m.

    What's wrong with my solution


    • 14
      magicalsoup  commented on Aug. 23, 2019, 2:30 p.m.

      Try this case

      3
      6

  • 4
    adriancerejo  commented on Oct. 28, 2018, 4:38 p.m.

    Didn't even realize the outputs had to be capitalized.


  • -7
    12weareunited  commented on Aug. 29, 2018, 12:56 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 5
      Arihan10  commented on Dec. 13, 2018, 6:26 p.m.

      @12weareunited You put an else statement without referencing an if statement first. The answer is in the error: else without if.