Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. barrels = 0
  2. tests = 0
  3. V = []
  4. VS = []
  5. S = []
  6.  
  7. input = open("input.txt", "r")
  8. output = open("output.txt", "w")
  9. s = input.read()
  10. s = s.split("\n")
  11. b = s[0].split(" ")
  12. del s[0]
  13. barrels = int(b[0])
  14. tests = int(b[1])
  15.  
  16. for y in range(barrels):
  17.     n = s[y]
  18.     n = n.split(" ")
  19.     V.append(int(n[0]))
  20.     VS.append(int(n[1]))
  21.  
  22. f = s[-1]
  23. f = f.split(" ")
  24. for z in f:
  25.     S.append(int(z))
  26.    
  27. def count(v, vs, s):
  28.     ans = []
  29.     a = 0
  30.     string = ""
  31.     for time in s:
  32.         for x in range(len(v)):
  33.             if (v[x] - vs[x] * time) >= 0:
  34.                a += v[x] - vs[x] * time
  35.         ans.append(a)
  36.         a = 0
  37.     for x in ans:
  38.         string += str(x) + " "
  39.     return string[0:-1]
  40.  
  41. output.write(count(V, VS, S))
  42.  
  43. input.close()
  44. output.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement