Radeen10-_

finaL submission Codeforces

Apr 16th, 2020 (edited)
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #creating three empty list
  2. price=[]
  3. amount=[]
  4. products=[]
  5. #declaring variables
  6. optimal_price=0
  7. minimum=120
  8. #number of elements as input
  9. n=int(input())
  10. #iterating till the range
  11. for j in range(n):
  12.     sle,ele=input().split()
  13.     sle=int(sle)
  14.     ele=int(ele)
  15.     amount.append(sle)
  16.     price.append(ele)
  17. #do a loop over price
  18. for idx,item in enumerate(price):
  19.     if(item>minimum):     #making a condition
  20.         price[idx]=minimum
  21.     else:
  22.         minimum=price[idx]
  23. #multiplication between  two lists
  24. for num1,num2 in zip(price,amount):
  25.     products.append(num1*num2)
  26. for gle in range(0,len(products)):
  27.     optimal_price=optimal_price+products[gle]
  28. print(optimal_price)
Add Comment
Please, Sign In to add comment