311357: CF1974A. Phone Desktop

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

Description

A. Phone Desktoptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input

The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output

For each test case, output the minimal number of required screens on a separate line.

ExampleInput
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
Output
1
1
2
2
1
1
0
1
1
2
5
Note

The solution for the first test case can look as follows:

Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

Output

题目大意:
小Rosie有一部手机,手机的桌面(或启动器)可以由多个屏幕组成。每个屏幕表示为5行3列的网格。有x个应用程序的图标大小为1×1单元格,这样的图标只占用屏幕的一个单元格。还有y个应用程序的图标大小为2×2单元格,这样的图标占用屏幕上的4个单元格。每个屏幕的每个单元格最多只能由一个图标占用。Rosie想要在尽可能少的屏幕上放置应用程序图标,帮助她找到所需的最小屏幕数量。

输入输出数据格式:
输入:
第一行包含t(1≤t≤10^4)——测试用例的数量。
每个测试用例的第一行包含两个整数x和y(0≤x,y≤99)——分别是1×1图标和2×2图标的应用程序数量。

输出:
对于每个测试用例,输出所需的最小屏幕数量。

示例:
输入:
```
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
```
输出:
```
1
1
2
2
1
1
0
1
1
2
5
```

注意:
第一个测试用例的解决方案如下:
![image](https://espresso.codeforces.com/69bfe873bb73df843b5e6cfe368944566e59deae.png)
蓝色方块代表图标的空位,绿色方块代表1×1图标,红色方块代表2×2图标。

第三个测试用例的解决方案如下:
![image](https://espresso.codeforces.com/facbdb8597936a2abe24d5c89da8f0ef149a84fb.png)题目大意: 小Rosie有一部手机,手机的桌面(或启动器)可以由多个屏幕组成。每个屏幕表示为5行3列的网格。有x个应用程序的图标大小为1×1单元格,这样的图标只占用屏幕的一个单元格。还有y个应用程序的图标大小为2×2单元格,这样的图标占用屏幕上的4个单元格。每个屏幕的每个单元格最多只能由一个图标占用。Rosie想要在尽可能少的屏幕上放置应用程序图标,帮助她找到所需的最小屏幕数量。 输入输出数据格式: 输入: 第一行包含t(1≤t≤10^4)——测试用例的数量。 每个测试用例的第一行包含两个整数x和y(0≤x,y≤99)——分别是1×1图标和2×2图标的应用程序数量。 输出: 对于每个测试用例,输出所需的最小屏幕数量。 示例: 输入: ``` 11 1 1 7 2 12 4 0 3 1 0 8 1 0 0 2 0 15 0 8 2 0 9 ``` 输出: ``` 1 1 2 2 1 1 0 1 1 2 5 ``` 注意: 第一个测试用例的解决方案如下: ![image](https://espresso.codeforces.com/69bfe873bb73df843b5e6cfe368944566e59deae.png) 蓝色方块代表图标的空位,绿色方块代表1×1图标,红色方块代表2×2图标。 第三个测试用例的解决方案如下: ![image](https://espresso.codeforces.com/facbdb8597936a2abe24d5c89da8f0ef149a84fb.png)

加入题单

算法标签: