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.
在关注商业公民组织(CCC)这里,我们注意到电话推销员喜欢使用七位电话号码,其中最后四位数字具有三个特性。仅查看最后四位数字,这些特性是:
这四位数字中的第一位是 8 或 9;
最后一位数字是 8 或 9;
第二位和第三位数字相同。
例如,如果电话号码的最后四位是 8229、8338 或 9008,这些是电话推销员的号码。
编写一个程序,根据最后四位数字判断一个电话号码是不是电话推销员的号码。如果号码不是电话推销员的号码,我们应该接听电话,否则,我们应该忽略它。