Tired of boring office work, Denis decided to open a fast food restaurant.

On the first day he made a portions of dumplings, b portions of cranberry juice and c pancakes with condensed milk.

The peculiarity of Denis’s restaurant is the procedure of ordering food. For each visitor Denis himself chooses a set of dishes that this visitor will receive. When doing so, Denis is guided by the following rules:

every visitor should receive at least one dish (dumplings, cranberry juice, pancakes with condensed milk are all considered to be dishes);

each visitor should receive no more than one portion of dumplings, no more than one portion of cranberry juice and no more than one pancake with condensed milk;

all visitors should receive different sets of dishes.

What is the maximum number of visitors Denis can feed?

Input

The first line contains an integer t (1≤t≤500) — the number of test cases to solve.

Each of the remaining t lines contains integers a, b and c (0≤a,b,c≤10) — the number of portions of dumplings, the number of portions of cranberry juice and the number of condensed milk pancakes Denis made.

Output

For each test case print a single integer — the maximum number of visitors Denis can feed.

Example

inputCopy

7

1 2 1

0 0 0

9 1 7

2 2 3

2 3 2

3 2 2

4 4 4

outputCopy

3

0

4

5

5

5

7

Note

In the first test case of the example, Denis can feed the first visitor with dumplings, give the second a portion of cranberry juice, and give the third visitor a portion of cranberry juice and a pancake with a condensed milk.

In the second test case of the example, the restaurant Denis is not very promising: he can serve no customers.

In the third test case of the example, Denise can serve four visitors. The first guest will receive a full lunch of dumplings, a portion of cranberry juice and a pancake with condensed milk. The second visitor will get only dumplings. The third guest will receive a pancake with condensed milk, and the fourth guest will receive a pancake and a portion of dumplings. Please note that Denis hasn’t used all of the prepared products, but is unable to serve more visitors.

3种水果最多能凑出几种来,每种同一种水果只能使用一次,也就是最多能凑出7来。无非就一样一个,任意两个,三个的这三种情况,比如有一种非常多,这里就让它先组成,比如2 2 3,

每样一个,组成3种后还有1 1 2,1/ 3, 2/3 能组成2个,1/2 的话就不行了,就这一个小细节。

#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for (int i = 0; i < t; i++)
{
int a, b, c;
cin >> a >> b >> c;
if (a == 1)
cout << 1 <<" "<<1<< endl;
else{
cout << max(1, min(a, b + c - a + 1)) << " ";
if (b + c - 1 >a)
cout << a << endl;
else
cout << min(a, a - (abs(a - b + 1 - c))) << endl;
}
}
}

Codeforces Round #622 (Div. 2) 1313 A的更多相关文章

  1. Codeforces Round #622 (Div. 2) 1313 B Different Rules

    B. Different Rules Nikolay has only recently started in competitive programming, but already qualifi ...

  2. Codeforces Round #622 (Div. 2) 1313 C1

    C1. Skyscrapers (easy version) time limit per test1 second memory limit per test512 megabytes inputs ...

  3. Codeforces Round #622 (Div. 2) C2. Skyscrapers (hard version)(单调栈,递推)

    Codeforces Round #622 (Div. 2) C2. Skyscrapers (hard version) 题意: 你是一名建筑工程师,现给出 n 幢建筑的预计建设高度,你想建成峰状, ...

  4. Codeforces Round #622 (Div. 2) B. Different Rules(数学)

    Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...

  5. Codeforces Round #622 (Div. 2) A. Fast Food Restaurant(全排列,DFS)

    Codeforces Round #622 (Div. 2) A. Fast Food Restaurant 题意: 你是餐馆老板,虽然只会做三道菜,上菜时还有个怪癖:一位客人至少上一道菜,且一种菜最 ...

  6. Codeforces Round #622 (Div. 2).C2 - Skyscrapers (hard version)

    第二次写题解,请多多指教! http://codeforces.com/contest/1313/problem/C2 题目链接 不同于简单版本的暴力法,这个数据范围扩充到了五十万.所以考虑用单调栈的 ...

  7. Codeforces Round #622 (Div. 2)C2 Skyscrapers最大"尖"性矩形,思维||分治

    题:https://codeforces.com/contest/1313/problem/C2 题意:给出n个数,分别代表第i个位置所能搭建的最大高度,问以哪一个位置的塔的高度为基准向左的每一个塔都 ...

  8. Codeforces Round #622(Div 2) C1. Skyscrapers (easy version)

    题目链接: C1. Skyscrapers (easy version) 题目描述: 有一行数,使得整个序列满足 先递增在递减(或者只递增,或者只递减) ,每个位置上的数可以改变,但是最大不能超过原来 ...

  9. Codeforces Round #622 (Div. 2) C2 - Skyscrapers (hard version) 单调栈

    从左往右扫,找到比第i个小的第一个数字,l[i] = l[last] + (i - last) * m[i],用单调栈O(n)维护这个过程,再从右往左扫,同理可以算出r数组,注意一下long long ...

随机推荐

  1. javascript入门 之 ztree (十 checkbox选中事件)

    <!DOCTYPE html> <HTML> <HEAD> <TITLE> ZTREE DEMO - beforeCheck / onCheck< ...

  2. 工作中常用的Android系统ADB命令收集

    ​工作中常用的Android系统ADB命令收集如下:先收藏以备以后查阅! ​ adb --help //adb帮助 adb start-server //启动adb server adb kill-s ...

  3. Android Google Play app signing 最终完美解决方式

    转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/105561341 本文出自[赵彦军的博客] 在 GooglePlay 创建 App ...

  4. getline()和get()的使用区别

    一.getline和get()的使用区别: 首先这两个函数都读取下一行输入,直到到达换行符:但是getline()函数会丢弃换行符,而get()将换行符保留在输入序列中 二.getline()函数的使 ...

  5. HashMap主要方法源码分析(JDK1.8)

    本篇从HashMap的put.get.remove方法入手,分析源码流程 (不涉及红黑树的具体算法) jkd1.8中HashMap的结构为数组.链表.红黑树的形式     (未转化红黑树时)   (转 ...

  6. A - Engines Atcoder 4900

    题目大意:n个点,任意几个点组合后得到的点距离原点的最远距离. 题解:极角排序:https://blog.csdn.net/qq_39942341/article/details/79840394 利 ...

  7. Problem E. Bet

    转载:https://blog.csdn.net/qq_40861916/article/details/84403731 #include<iostream> #include<c ...

  8. 腾讯云集群服务部署mysql并挂载到服务器

    一.背景 由于现在大部分的应用都是运行在云服务器上的,而现在大多数文章都是主要写如何在服务器上使用docker去运行mysql,比较少有介绍云服务器上的.再加上现在k8s比较火爆,而云厂商大多数都提供 ...

  9. Java中常用的七个阻塞队列第二篇DelayQueue源码介绍

    Java中常用的七个阻塞队列第二篇DelayQueue源码介绍 通过前面两篇文章,我们对队列有了了解及已经认识了常用阻塞队列中的三个了.本篇我们继续介绍剩下的几个队列. 本文主要内容:通过源码学习De ...

  10. Unity 游戏框架搭建 2019 (三十二、三十三) 类的命名 & 代码文件命名

    昨天我们完成了第八个示例的第二个 MenuItem 菜单顺序的调整. 我们今天再往下接着调整. 我们来看下接下来的 MenuItem 代码如下: [MenuItem("QFramework/ ...