Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = input().split()
- a = list(map(int, a))
- f = [str(a[0]), str(a[1])+'x', str(a[2])+'y']
- x = []
- if f[0] != '0':
- x.append(f[0])
- if f[1][0] != '0':
- x.append(f[1])
- if f[2][0] != '0':
- x.append(f[2])
- if len(x) == 3:
- x[-2] = x[-2].replace('-1x', '-x').replace('1x', 'x')
- x[-1] = x[-1].replace('-1y', '-y').replace('1y', 'y')
- if x[1][0] != '-':
- x[1] = ('+' + x[1])
- if x[2][0] != '-':
- x[2] = ('+' + x[2])
- print(''.join(x))
- if len(x) == 2:
- x[-2] = x[-2].replace('-1x', '-x').replace('1x', 'x')
- x[-1] = x[-1].replace('-1y', '-y').replace('1y', 'y')
- if x[1][0] != '-':
- x[1] = ('+' + x[1])
- print(''.join(x))
- if len(x) == 1:
- if x[0] =='1x' or x[0] == '-1x':
- x[0] = x[0].replace('-1x', '-x').replace('1x', 'x')
- else:
- x[0] = x[0].replace('-1y', '-y').replace('1y', 'y')
- print(''.join(x))
- if x == []:
- print(0)
Advertisement
Add Comment
Please, Sign In to add comment