求调
查看原帖
求调
977778
__Harry_Haiyun__楼主2024/1/13 17:50
#include <bits/stdc++.h>
#define int long long
#define iostream() ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
using namespace std;
const int maxn = 1e6+7;
const int MAXN = maxn / 2;
int n,a,x,y,tmp[maxn],fcnt;
bool f = 0;
signed main()
{
    iostream();
    int n;
    cin >> n;
    while (n--)
    {
    	cin >> x;
    	cin >> a;
    	for (int i = 0; i < a; i++) cin >> tmp[i];
    	cin >> y;
    	for (int i = 0; i < a; i++)
    	{
    		if (tmp[i] > y)
    		{
    			f = 1;
    			fcnt++;
			}
		}
    	if (f) cout << y - (a - fcnt) - x + 1 << '\n';
    	else cout << y - a - x + 1 << '\n';
	}
 	return 0;
}
2024/1/13 17:50
加载中...