Advertisement
Guest User

Babbling Brooks

a guest
Jan 27th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. streamCount = int(input())
  2. streamNum = int(0)
  3. flow = []
  4.  
  5. while streamNum < streamCount:
  6.     flow.append(float(input()))
  7.     streamNum += 1
  8.  
  9. while True:
  10.     command = input()
  11.     if command == '99':
  12.         splitNum = int(input()) - 1
  13.         splitRatio = int(input())
  14.         oldFlow = float(flow[splitNum])
  15.         flow[splitNum] = splitRatio * flow[splitNum] / 100
  16.         newStreamFlow = float(oldFlow - flow[splitNum])
  17.         flow.insert(splitNum+1, newStreamFlow)
  18.         streamCount += 1
  19.     elif command == '88':
  20.         joinNum = int(input()) - 1
  21.         streamCount -= 1
  22.         flow[joinNum] += flow[joinNum+1]
  23.         flow.pop(joinNum+1)
  24.     else:
  25.         break
  26.  
  27. printCount = 0
  28. while printCount < streamCount:
  29.     print(int(round(flow[printCount])), sep=' ', end=' ', flush=True)
  30.     printCount += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement