编程介的小学生 2017-09-10 14:03 采纳率: 20.5%
浏览 878
已采纳

Basic

The programming language Ada has integer constants that look like this: 123, 8#123#, 16#abc#. These constants represent the integers 123, 83 (123 base 8) and 2739 (abc base 16). More precisely, an integer may be a decimal integer given as a sequence of one or more digits less than 10, or it may be an integer to some specific base, given as the base followed by a sequence of one or more digits less than the base enclosed by # symbols. Lower case letters from a through f are used as the digits representing 10 through 15. In Ada, the base, if specified, must be a sequence of decimal digits. For this problem, however, the base may be of any form described above so long as it represents an integer between 2 and 16 inclusive.

Input

The first line of input contains a positive integer n. n lines follow.

Output

For each line of input, output a line "yes" if it is a valid integer constant according to the above rules; otherwise output a line containing "no". Input lines contain no spaces and are between 1 and 80 characters in length.

Sample Input

5
2#101#
2#101##123#
17#abc#
16#123456789abcdef#
16#123456789abcdef#123456789abcdef#

Sample Output

yes
yes
no
yes
no

  • 写回答

1条回答

  • threenewbee 2017-09-27 14:11
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!