2018百度之星初赛(B)1001

。。。 

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+9;
int sum[N];
int main()
{
  //  freopen("in.txt","r",stdin);
    ios::sync_with_stdio(false);
    int t;
    int n,m,k;
    cin>>t;
    while(t--)
    {
        memset(sum,0,sizeof(sum));
        cin>>n>>m>>k;
        int a,b;
        for(int i = 0; i<m; i++)
        {
            cin>>a>>b;
            sum[a]++;
            sum[b]++;
        }
        int x = 0;
        for(int i = 0; i<N; i++){
            x = max(x,sum[i]);
        }
        if(n-1-m+x+k>n-1) cout<< n-1 <<endl;
        else cout<< n-1-m+x+k <<endl;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41156122/article/details/81612459