307504: CF1366A. Shovels and Swords

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Shovels and Swords

题意翻译

### 题目描述 在 MC 中,一把钻石锹要一个钻石和两个木棍合成,一把钻石剑要两个钻石和一个木棍合成,每把钻石工具都能去与村民交易获得 $1$ 个绿宝石。现在有 $a$ 个木棍和 $b$ 个钻石,最多能换到多少绿宝石? ### 输入格式 第一行一个整数 $t\ (1\leq t\leq 1000)$,代表数据组数。 接下来 $t$ 行每行两个整数 $a,b\ (0\leq a,b\leq 10^9)$,代表木棍和钻石的数量。 ### 输出格式 $t$ 行,每行一个整数,代表最多能换到绿宝石的数量。 Translated By Karry5307

题目描述

Polycarp plays a well-known computer game (we won't mention its name). In this game, he can craft tools of two types — shovels and swords. To craft a shovel, Polycarp spends two sticks and one diamond; to craft a sword, Polycarp spends two diamonds and one stick. Each tool can be sold for exactly one emerald. How many emeralds can Polycarp earn, if he has $ a $ sticks and $ b $ diamonds?

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of test cases. The only line of each test case contains two integers $ a $ and $ b $ ( $ 0 \le a, b \le 10^9 $ ) — the number of sticks and the number of diamonds, respectively.

输出格式


For each test case print one integer — the maximum number of emeralds Polycarp can earn.

输入输出样例

输入样例 #1

4
4 4
1000000000 0
7 15
8 7

输出样例 #1

2
0
7
5

说明

In the first test case Polycarp can earn two emeralds as follows: craft one sword and one shovel. In the second test case Polycarp does not have any diamonds, so he cannot craft anything.

Input

题意翻译

### 题目描述 在 MC 中,一把钻石锹要一个钻石和两个木棍合成,一把钻石剑要两个钻石和一个木棍合成,每把钻石工具都能去与村民交易获得 $1$ 个绿宝石。现在有 $a$ 个木棍和 $b$ 个钻石,最多能换到多少绿宝石? ### 输入格式 第一行一个整数 $t\ (1\leq t\leq 1000)$,代表数据组数。 接下来 $t$ 行每行两个整数 $a,b\ (0\leq a,b\leq 10^9)$,代表木棍和钻石的数量。 ### 输出格式 $t$ 行,每行一个整数,代表最多能换到绿宝石的数量。 Translated By Karry5307

加入题单

上一题 下一题 算法标签: