Burgers
Problem Statement - link #
Chef is fond of burgers and decided to make as many burgers as possible.
Chef has A patties and B buns. To make 1 burger, Chef needs 1 patty and 1 bun. Find the maximum number of burgers that Chef can make.
Input Format:
- The first line contains an integer T, the number of test cases. Then the test cases follow.
- The first and only line of each test case 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 Chef can make.
Examples #
Example 1:
Input :
4
2 2
2 3
3 2
23 17
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, and therefore Chef can make 2 burgers.
Test Case 3: Chef has 3 patties and 2 buns, and therefore Chef can make 2 burgers.
Test Case 4: Chef has 23 patties and 17 buns, and therefore Chef can make 17 burgers.
Constraints #
1 ≤ T ≤ 1000
1 ≤ A,B ≤ 100000
Solutions #
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int MOD = 1e9+7;
int solution(int a, int b) {
return min(a, b);
}
int main() {
// your code goes here
int T; cin >> T;
int a,b;
while(T--) {
cin >> a >> b;
auto res = solution(a, b);
cout << res << endl;
}
return 0;
}