题解 | #游游的整数切割#


number = input()

def even_check(num):
    even_list = ['2', '4','6', '8', '0']
    if num[-1] in even_list:
        return 0 # even
    else:
        return 1 # odd

count = 0
for i in range(1,len(number)):
    part_a = number[:i]
    part_b = number[i:]
    a_result =  even_check(part_a)
    b_result =  even_check(part_b)
    if a_result == b_result:
        count += 1
print(count)

全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务