鸡兔同笼

a,b = map(int,input().split(' '))
if (a>0 and b>0 and a<b and b%2==0 and b-2*a>0):  
    for x in range(1,a+1):     
        y = a-x
        if 2*x + 4*y == b:   
            print('{} {}'.format(x,y))
            break
        if y==0:
            print('Data Error!')
            
else:
    print("Data Error!")

 

posted @ 2020-04-14 22:23  林晓婷  阅读(225)  评论(0)    收藏  举报