CCC '18 J1 - Telemarketer or not?

View as PDF

Submit solution

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

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

Here at the Concerned Citizens of Commerce (CCC), we have noted that telemarketers like to use seven-digit phone numbers where the last four digits have three properties. Looking just at the last four digits, these properties are:

  • the first of these four digits is an 8 or 9;
  • the last digit is an 8 or 9;
  • the second and third digits are the same.

For example, if the last four digits of the telephone number are 8229, 8338, or 9008, these are telemarketer numbers.

Write a program to decide if a telephone number is a telemarketer number or not, based on the last four digits. If the number is not a telemarketer number, we should answer the phone, and otherwise, we should ignore it.

Input Specification

The input will be 4 lines where each line contains exactly one digit in the range from 0 to 9.

Output Specification

Output either ignore if the number matches the pattern for a telemarketer number; otherwise, output answer.

Sample Input 1

9
6
6
8

Sample Output 1

ignore

Explanation for Sample Output 1

The first digit is 9, the last digit is 8, and the second and third digit are both 6, so this is a telemarketer number.

Sample Input 2

5
6
6
8

Sample Output 2

answer

Explanation for Sample Output 2

The first digit is 5, and so this is not a telemarketer number.


Comments


  • -1
    R_G  commented on Feb. 6, 2024, 10:36 p.m.

    My code does not run!

    May someone please help me?

    n = int(input())

    n1 = int(input())

    n2 = int(input())

    n3 = int(input())

    if n == 8 or n == 9: if n1 == n2: if n3 == 8 or n3 == 9: print("ignore") if n1 == n2: print("ignore") else: print("answer")


    • 1
      htoshiro  commented on Feb. 6, 2024, 11:08 p.m.

      read the instructions properly is it first number is equal to second?


      • 0
        R_G  commented on Feb. 7, 2024, 1:06 a.m.

        but n is my first number

        n1 is my second and n2 is my third

        but thanks for trying to help me


  • 0
    R_G  commented on Jan. 26, 2024, 10:29 p.m. edited

    when i write my code, it does not run the rest of the test cases

    can someone tell me what is goin on


    • 1
      Viv_CCGS  commented on Jan. 27, 2024, 7:43 a.m.

      In some cases, if you do not pass the first batch, they will not test your code on later batches. This is mostly for non-subtask specific problems. Once your code passes the first batch, it will be tested on the next one.

      Hope this helps.


      • 0
        R_G  commented on Jan. 30, 2024, 11:20 p.m.

        ty


      • 1
        htoshiro  commented on Jan. 27, 2024, 3:02 p.m.

        (this is also called short circuiting) as in for your code you forgot to add 2 pairs of brackets somewhere


        • 0
          R_G  commented on Jan. 30, 2024, 11:19 p.m.

          Ty


  • -15
    Broken_Dreams  commented on April 21, 2022, 11:18 p.m.

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


  • 4
    cyopotatoe  commented on June 3, 2020, 12:58 a.m.

    So I wanted to see if capitalization counts. It does. Beware, unsuspecting CCC users!


  • 28
    Joethenerd  commented on Feb. 20, 2019, 3:04 p.m.

    Man spelling counts! Couldn't get this 3 pointer cause I wrote ingore instead of ignore. And i dint realize for the longest time.


    • 3
      Bigg_Pete  commented on Dec. 23, 2021, 5:09 p.m.

      I had the same problem, except I was using "Ignore" and "Answer" instead of "ignore" and "answer". Case sensitivity is a killer here.


  • 9
    1DontKnowHowIGotHere  commented on April 30, 2018, 4:24 p.m.

    Misread a part of the question.


  • -9
    1DontKnowHowIGotHere  commented on April 28, 2018, 12:33 a.m. edited

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


    • 7
      CoolNoobyBooby  commented on Aug. 22, 2018, 8:35 p.m.

      Note that:

      ignore is when the first and last digits are either 8 or 9 and the two of the middle are the same, not answer

      That may be the problem


    • 2
      TimothyW553  commented on April 29, 2018, 1:47 a.m.

      Also, you should probably read the question again because your if statements are wrong


    • 46
      Roynaruto  commented on April 28, 2018, 8:51 p.m.

      Considering that:

      1. This was a CCC contest question, so the test datas were checked over
      2. There are 300 correct submissions on DMOJ

      Perhaps you should check over your code.


      • -93
        TimothyW553  commented on April 29, 2018, 1:43 a.m.

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


        • -40
          cyopotatoe  commented on June 3, 2020, 1:00 a.m.

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