Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- time = list(map(int,input().split(' ')))
- left = 0
- right = 0
- for i in range(len(time) // 2):
- left += time[i]
- if time[i] == 0:
- left *= 0.8
- right += time[len(time) - (1 + i)]
- if time[len(time) - (1 + i)] == 0:
- right *= 0.8
- if left < right:
- print(f'The winner is left with total time: {left:.1f}')
- else:
- print(f'The winner is right with total time: {right:.1f}')
- Решение с колекция:
- time = list(map(int, input().split(' ')))
- data = {'left': 0, 'right': 0, "side": ''}
- for i in range(len(time) // 2):
- data['left'] += time[i]
- if time[i] == 0:
- data['left'] *= 0.8
- data['right'] += time[len(time) - (1 + i)]
- if time[len(time) - (1 + i)] == 0:
- data['right'] *= 0.8
- data["side"] += 'left' if data['left'] < data['right'] else 'right'
- print(f'The winner is {data["side"]} with total time: {data[data["side"]]:.1f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement