CodeChef - Python Practice Solution - Burgers

Problem:
  • The chef is fond of burgers and decided to make as many as possible.
  • The chef has A patties and B buns. To make 11 burgers, Chef needs 11 patties and 11 buns.
  • Find the maximum number of burgers that the Chef can make.
Input Format:
  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • Each test case's first and only line contains two space-separated integers A and B, the number of patties and buns respectively.
Output Format:
  • For each test case, output the maximum number of burgers that the Chef can make.
Constraints:
  • 1≤ T ≤1000
  • 1≤ A, B ≤10^5
Sample Input:

4
2 2
2 3
3 2
23 17
Sample Output:

2
2
2
17
Explanation:
  • Test case 1: Chef has 2 patties and 2 buns, and therefore Chef can make 2 burgers.
  • Test case 2: Chef has 2 patties and 3 buns. The chef can make at most 2 burgers by using 2 patties and 2 buns.
  • Test case 3: Chef has 3 patties and 2 buns. The chef can make at most 2 burgers by using 2 patties and 2 buns.
  • Test case 4: Chef has 23 patties and 17 buns. The chef can make at most 17 burgers by using 17 patties and 17 buns.
Solution:

for _ in range(int(input())):
    print(min(list(map(int,input().split()))))
Note: The problem statement is given by codechef.com but the solution is generated by the Geek4Tutorial admin. We highly recommend you solve this on your own, however, you can refer to this in case of help. If there is any concern regarding this post or website, please contact us using the contact form. Thank you!

No comments:

Post a Comment

You might also like

Deploy your Django web app to Azure Web App using App Service - F1 free plan

In this post, we will look at how we can deploy our Django app using the Microsoft Azure app service - a free plan. You need an Azure accoun...