2019-03-04 19:48:13 Python

018

Copy Copied! Full
NumOfRecipe=int(input()) recipe_dict={} for r in range(NumOfRecipe): deta_recipe=input().split() nameoffood=deta_recipe[0] numoffood=deta_recipe[1] recipe_dict[nameoffood]=numoffood NumOfhave=int(input()) count=[] for f in range(NumOfhave): deta_have=input().split() nameofhave=deta_have[0] numofhave=deta_have[1] if(nameofhave in recipe_dict): need=recipe_dict[nameofhave] n=int(numofhave)//int(need) count.append(n) if(len(count)==0): print(0) else: print(min(count))
018
RECOMMEND