a,b = input().split(' ') str1 = a + b lis1 = ['01', '12', '20'] lis2 = ['10', '21', '02'] if str1 in lis1: print('-1') elif str1 in lis2: print('1') else: print('0')
a,b=map(int,input().strip().split()) if (a==b): print(0) elif((a==0 and b==2) or (a==1 and b==0) or (a==2 and b==1)): print(1) elif((a==0 and b==1) or (a==1 and b==2) or (a==2 and b==0)): print(-1)
如果设前后两个数字为a,b,那么,当结果为0时的情况,a-b=0;当结果为-1时的情况,a-b=-1 or 2;当结果为1时的情况,a-b=1 or -2; 故也可以这样: x,y=map(int,input().split()) a=x-y if a==0: print(0) elif a==-1 or a==2: print(-1) elif a==1 or a==-2: print(1)