Untitled
unknown
python
8 months ago
414 B
10
Indexable
Never
def getMaxUpgradedServers(num_servers, money, sell, upgrade): ans=[] for i in range(len(num_servers)): lo,hi=0,num_servers[i] temp=0 while(lo<=hi): mid=lo+(hi-lo)//2 if(mid*upgrade[i]<=money[i]+sell[i]*(num_servers[i]-mid)): temp=mid lo=mid+1 else: hi=mid-1 ans.append(temp) return ans
Leave a Comment