永发信息网

英语翻译The programming language Ada has integer constants that

答案:1  悬赏:20  手机版
解决时间 2021-01-03 13:19
  • 提问者网友:富士山上尢
  • 2021-01-02 23:07
英语翻译
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
最佳答案
  • 五星知识达人网友:拾荒鲤
  • 2021-01-03 00:02

ada(一种编程语言)有两种整形常量如下:123,8#123#,16#abc#.这些常量表示整数123,83(八进制123),2739(16进制abc).严格的说:一个整形可以使一系列小于10的数字表示的十进制数,或是一个由符号#表示的x进制数.小写字母a到f表示十进制的10到15.进制数x的范围是2到16.
输入
第一行输入一个正数n.后面几行输入n行.
输出
对于每行输出,'yes'表示 此数按照以上规则合法.反之,'no'表示非法
输入数字在1到80字符之间.
输入例子
xxx
输出例子
xxxxx


我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯