CF1882A.Increasing Sequence
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a sequence a1,a2,…,an. A sequence b1,b2,…,bn is called good, if it satisfies all of the following conditions:
- bi is a positive integer for i=1,2,…,n;
- bi=ai for i=1,2,…,n;
- b1<b2<…<bn.
Find the minimum value of bn among all good sequences b1,b2,…,bn.
给定一个序列 a1,a2,…,an。若序列 b1,b2,…,bn 满足以下所有条件,则称其为好序列:
- 对于 i=1,2,…,n,bi 是正整数;
- 对于 i=1,2,…,n,bi=ai;
- b1<b2<…<bn。
求所有好序列 b1,b2,…,bn 中 bn 的最小可能值。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤100). The description of the test cases follows.
The first line of each test case contains a single integer n (1≤n≤100).
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤109).
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤100)。随后是测试用例的描述。
每个测试用例的第一行包含一个整数 n(1≤n≤100)。
每个测试用例的第二行包含 n 个整数 a1,a2,…,an(1≤ai≤109)。
输出格式
For each test case, print a single integer — the minimum value of bn among all good sequences b.
对于每个测试用例,输出一个整数——所有好序列 b 中 bn 的最小值。
输入输出样例
输入#1
3 5 1 3 2 6 7 4 2 3 4 5 1 1
输出#1
8 4 2
说明/提示
In the first test case, b=[2,4,5,7,8] is a good sequence. It can be proved that there is no good b with b5<8.
In the second test case, b=[1,2,3,4] is an optimal good sequence.
In the third test case, b=[2] is an optimal good sequence.
在第一个测试用例中,b=[2,4,5,7,8] 是一个好序列。可以证明:不存在满足 b5<8 的好序列 b。
在第二个测试用例中,b=[1,2,3,4] 是一个最优的好序列。
在第三个测试用例中,b=[2] 是一个最优的好序列。
输入解题思路,AI测评打分。不知道怎么写?