解题思路:
1、EOF即为"End of file"缩写
2、四个整数中不允许有前导零存在:即当数字长度大于一位时(0是可以的),第一位为0的数都是含有前导零的数
参考代码:
while True:
try:
ip = input().split('.')
f = True
for i in ip:
if (len(i) > 1 and i[0] == '0') or (not i.isdigit()) or (not 0 <= int(i) <= 255):
print('N')
f = False
break
if f:
print('Y')
except EOFError:
break
0.0分
4 人评分