最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1849A - Morning Sandwich

2023-08-16 11:46 作者:您是打尖兒還是住店呢  | 我要投稿

Monocarp always starts his morning with a good ol' sandwich. Sandwiches Monocarp makes always consist of bread, cheese and/or ham.


A sandwich always follows the formula:

a piece of bread a slice of cheese or ham a piece of bread…

a slice of cheese or ham a piece of bread

So it always has bread on top and at the bottom, and it alternates between bread and filling, where filling is a slice of either cheese or ham. Each piece of bread and each slice of cheese or ham is called a layer.


Today Monocarp woke up and discovered that he has b pieces of bread, c slices of cheese and h slices of ham. What is the maximum number of layers his morning sandwich can have?

Input

The first line contains a single integer t (1≤t≤1000) — the number of testcases.

Each testcase consists of three integers b,c and h (2≤b≤100; 1≤c,h≤100) — the number of pieces of bread, slices of cheese and slices of ham, respectively.

Output

For each testcase, print a single integer — the maximum number of layers Monocarp's morning sandwich can have.

--------------------------------------

Monocarp 總是以美味的三明治開始新的一天。 Monocarp 制作的三明治通常由面包、奶酪和/或火腿組成。


三明治總是遵循以下公式:

一片面包一片奶酪或火腿一片面包……

一片奶酪或火腿 一塊面包

所以它的頂部和底部總是有面包,并且它在面包和餡料之間交替,其中餡料是一片奶酪或火腿。 每片面包和每片奶酪或火腿稱為一層。


今天Monocarp醒來發(fā)現(xiàn)他有b片面包,c片奶酪和h片火腿。 他的早餐三明治最多可以有多少層?

輸入

第一行包含一個整數(shù) t (1≤t≤1000) — 測試用例的數(shù)量。

每個測試用例由三個整數(shù) b、c 和 h 組成(2≤b≤100;1≤c,h≤100)——分別是面包片、奶酪片和火腿片的數(shù)量。

輸出

對于每個測試用例,打印一個整數(shù) - Monocarp 的早晨三明治可以有的最大層數(shù)。

--------------------------------

確定三明治的最大層次,其實(shí)就是判斷面包跟火腿還有起司的數(shù)量即可,下面是代碼:


CF 1849A - Morning Sandwich的評論 (共 條)

分享到微博請遵守國家法律
蓬溪县| 敦化市| 交口县| 伽师县| 遂昌县| 和平县| 深州市| 五莲县| 汝南县| 鹤壁市| 洪泽县| 稷山县| 湟源县| 石景山区| 章丘市| 塘沽区| 濉溪县| 衡阳县| 耒阳市| 乐昌市| 益阳市| 宜君县| 五家渠市| 五大连池市| 扎兰屯市| 集贤县| 无为县| 杭州市| 启东市| 兴化市| 嘉善县| 广德县| 大庆市| 饶阳县| 舒兰市| 那坡县| 江门市| 长沙县| 湘阴县| 醴陵市| 伊川县|