Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PRICE_IN = 3 / 1000000
- PRICE_OUT = 15 / 1000000
- PRICE_CACHE_WRITE = PRICE_IN * 1.25
- PRICE_CACHE_READ = PRICE_IN * .1
- def total_tk_in(start, input, output, turns):
- total = 0
- next = start + input
- for i in range(turns):
- total += next
- next += output + input
- return total
- def total_tk_out(output, turns):
- return output * turns
- def price_full(input, output):
- return input * PRICE_IN + output * PRICE_OUT
- def price_cache(start, input, output, turns, total_in, total_out):
- cache_write_tk = (start + input * turns + output * (turns-1))
- cache_write = cache_write_tk * PRICE_CACHE_WRITE
- cache_read_tk = total_in - cache_write_tk
- cache_read = cache_read_tk * PRICE_CACHE_READ
- price_output = total_out * PRICE_OUT
- total = cache_write + cache_read + price_output
- return total
- for j in [2000, 8000, 20000]:
- for i in [1,2,3,6,12]:
- x = total_tk_in(j, 20, 170, i)
- y = total_tk_out(170, i)
- price = price_full(x,y)
- price_cached = price_cache(j, 20, 170, i, x, y)
- discount = (1 - price_cached / price) * 100
- print("{}, {}, {:.4f}, {:.4f}, {:.0f}%".format(x,y,price,price_cached,discount))
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement